3.5. Objects

The supported objects in SCN can be of two types. The objects of the first type define a closed volume, while the others do not and must be handled with care inside CSG operations (see the list primitive bellow). Any object may inherit global attributes like surface, textures and transformations or else define its private attributes using the data keyword before its geometric information. It is also possible to group several objects and make them share some attributes using the group ... ungroup keywords. Example:

    transform none
    surface matte white                 ; current surface
    box ...                             ; white
    group
      surface matte red                 ; current surface inside block
      transform rotate y 45 ...         ; current transform inside block
      sphere ...                        ; rotated, red
      cone surface matte green data ... ; rotated, green
      cube bump data ...                ; rotated, red, bump texture
      cylinder ...                      ; rotated, red
    ungroup
    prism ...                           ; white

The closed objects are:

sphere [... data] center radius - a sphere.

box [... data] center sizes - an axis aligned box.

cube [... data] center size - an axis aligned cube.

cone [... data] apex base base_radius - a cone.

cylinder [... data] apex base radius - a cylinder.

cone truncated [... data] apex apex_radius base base_radius - truncated cone.

wedge [... data] point point point depth - a wedge is defined by a triangular face and an extrusion vector whose length is depth; the face is defined counterclockwise and the vector points in the Right Hand Rule direction (this convention is general in SCN).

tetra [... data] point point point point - a general tetrahedron (composed of four triangles).

prism [... data] depth vertices point ... point - a prism defined by a polygonal face and an extrusion vector similar to wedge.

pyramid [... data] depth vertices point ... point - a pyramid.

torus [... data] out_radius in_radius start_angle end_angle [out_samples in_samples] - a torus is centered in 0 0 0 and lies in the XY plane (0 degrees is in the X axis direction and increases counterclockwise). Actually, a torus is composed by a collection of Phong triangles whose density is defined by out_samples in_samples (default 16 8).

text3d file [... data] filename - text primitives stored in a file (high quality 3D letters, symbols, etc).

Examples of closed objects:

The opened objects are:

cone open [... data] apex base base_radius

cylinder open [... data] apex base radius

cone truncated open [... data] apex apex_radius base base_radius

prism open [... data] depth vertices point ... point

pyramid open [... data] depth vertices point ... point

pyramid truncated open [... data] depth apex_scale vertices point ... point - this is an opened pyramid with the apex face scaled by apex_scale in relation to its base face (0 is an opened pyramid and 1 is a opened prism).

disc [... data] center normal radius - a circle.

ring [... data] center normal out_radius in_radius - a circle with a hole.

patch [... data] point ... point (12) - a bicubic patch is defined by its corners and eight exterior points.

patch file [... data] [point [point]] filename - a group of patches stored in a file; first point defines a translation and second a scaling.

polygon [... data] vertices point ... point - polygon without holes.

polygon file [... data] [point [point]] filename - a group of polygons stored in a file.

triangle [... data] point point point

quadrangle [... data] point point point point - four-sided polygon.

triangle normal [... data] point vector point vector point vector - a triangle with normals in its vertices (also called Phong triangles).

triangle normal file [... data] [point [point]] filename - a group of Phong triangles stored in a file.

triangle general [... data] point vector point vector point vector surface surface surface - a triangle with normals and surfaces in its vertices. It is similar to a triangle normal, but allows the interpolation of any (or all) of the surface parameters inside itself.

triangle general file [... data] [point [point]] filename - a group of Phong triangles stored in a file.

torus open [... data] out_radius in_radius start_angle end_angle [out_samples in_samples] - an open torus.

Examples of opened objects:

Finally there are instructions that allow the creation of complex objects:

csg operation [... data] begin - begin of a CSG operation. The type of operation may be union, intersection or subtraction. A CSG (Constructive Solid Geometry) is a binary operation performed on two object operands (which may also be CSG's).

csg next - this instruction separates the definition of the left (first) operand of the CSG from the right (second) operand.

csg end - this instruction terminates the CSG.

Examples of CSG objects:

There is also one instruction that joins several simple objects into a primitive object. This is mandatory for CSG or else errors will appear in the picture:

list [... data] begin - start of a list of objects, at least two.

list end.

This instruction must be used in a CSG context when at least one of the operands is composed of opened objects (please note that each CSG operand must bound a finite volume). Example:

    list surface matte brown begin ; a new object similar to a pencil
      cylinder open  0 -1 0   0 1 0   0.3
      cone open      0 1.3 0  0 1 0   0.3
      sphere         0 -1 0           0.3
    list end


To Table of Contents
To 3. Syntax
Back To 3.4. Surfaces
Forward To 3.6. Transformations