material

A surface material.

Signatures

  • material( int mat_code )
  • material( int mat_code, color diff_color )

Details

Materials are defined by their material code, and their diffusive color.

Materials can be casted to modifiers and can thus be applied to solids accordingly.

Remark

Some materials (like gold) have a diffusive color on their own that cannot be changed. The diff_color parameter will be ignorde by these.

Material type setting

The material type is defined by the integral value mat_code. The actual attribution of its value to a certain material depends on the visualization type that is chosen for displaying the model (e.g. the trCAD online editor or paramate visualizers).

Although the material code can be provided as simple number, this is not recommended since the numerical value may change in further versions of the system. Instead it is recommended to import package "materials.sps" and use the material enumerations provided there (see the materials documentation).

Example

 #import ( "std/materials.sps" )
 enum mat_codes = materials::materials

 make material( mat_codes::PLASTICS, rgb( 255,0,255 ) ) >> torus()
 

Casts To

string
modifier

Parameters

mat_code

Integral code value defining the material type.

diff_color

The diffusive color of the material. See data type color.

See also