extrude

Syntax

  • extrude(distance)
  • extrude(extrusionType, distance)

Parameters

  1. distancefloat
    How many units to extrude.
  2. extrusionTypeselector
    • world.up—Extrudes faces along the world coordinates system’s y-axis.
    • world.up.flatTop—Same as world.up but creates a flat top surface.
    • face.normal—Each face is extruded along its normal. face.normal is the default.
    • vertex.normal—Extrudes face vertices along their normals. Duplicate vertices must be merged in order to compute vertex normals using adjacent face normals.

Description

The extrude operation extrudes the shape. Each face polygon of all meshes in the geometry asset is taken and extruded along the face normal or a given direction as specified by the extrusion type. The scope orientation is set in the following way:

  • x-axis direction is kept as much as possible (old x-axis is projected to the plane orthogonal to extrusion direction).
  • y-axis along the extrusion direction.
  • z-axis normal to the two above.

The scope’s sizes are adjusted to tightly fit the extruded geometry. If distance is negative, the scope.sy attribute will be negative. Texture coordinates are inherited from the shape.

Examples

Extrusion along normals

On the right, an initial shape consisting of 2 faces and the initial scope is shown.

Initial shape with two faces

The extrude operation extrudes all faces along their normals and combines the results. No internal lamina faces are created.

The scope’s y-axis is set to the extrusion direction.

Lot-->
   extrude(10)
Shape with two faces extruded

For uneven shapes the extrusion is performed for each face individually and internal faces are created.

The scope’s y-axis is set to the normal of the first face.

Lot-->
   extrude(face.normal,10)

Using face.normal is the default and the same as extrude(10).

Uneven shapes extruded

The extrusion along vertex normals keeps faces together and no internal faces are created.

The scope’s y-axis is set to the normal of the first vertex.

Lot-->
   extrude(vertex.normal,10)
Uneven shapes extruded along vertices
 

Extrusion along a world coordinate axis

Each face is extruded along the world coordinate’s y-axis. No internal lamina faces are created.

The scope’s y-axis is set to the world’s y-axis.

Lot-->
   innerRectangle(scope) { shape     : Shape 
                         | remainder : Remainder }
Shape-->
   extrude(world.up,10)
Remainder-->
   color(0,1,0)
Faces extruded along world axis

A flat top surface is created. The extrusion distance is measured from the lowest vertex of each shape wrt. to the world’s y-axis.

Shape-->
   extrude(world.up.flatTop,10)
Extrusion with flat top

The extrusion distance is set to at least the maximum extent of the shape along the world’s y-axis. If the distance is zero the extrusion is positive.

Shape-->
   extrude(world.up.flatTop,0)
Flat top extrusion with 0 distance

If the distance is negative the extrusion is measured from the highest vertex of each shape wrt. to the world’s y-axis.

The scope’s y-size becomes negative.

Shape-->
   extrude(world.up.flatTop,-10)
Flat top extrusion with -10 distance
 

Was this article helpful?