subdiv

Ensures a mesh solid exhibits a certain maximum edge length.

Signatures

  • subdiv( float maxlen )
  • subdiv( float maxlen, vector v1 )
  • subdiv( float maxlen, vector v1, vector v2 )

Details

The subdiv modifier checks whether the absolute length (constructor (1)) or the projected lengths onto vectors v1 and/or v2 (constructor (2) and (3)) of the edges of a solid mesh are equal or shorter than maxlen. If this is not the case for some edges, these triangles get subdivided to fulfil the condition.

A finer mesh may be useful for operations like bending that transform the vertices of a solid's mesh in a non-linear way. If the resolution is not fine enough this may lead in unexpectedly "edgy" results. The following example compares a bending with and without the application of subdiv:

Example

 modifier bend = bending( 1.0, <[1.0, 0.0, 0.0]>, <[0.0, 0.0, 0.0]>, <[0.0, 0.0, 1.0]> )

 make translation( <[0.0, 0.0, 0.0]>) >>
      bend >> cylinder()
 make translation( <[0.0, 2.0, 0.0]>) >>
      bend >> subdiv( 0.1, <[0.0, 0.0, 0.1]> ) >> cylinder()
 

Bending of a cylinder primitive without (left) and with (right) previous application of a subdiv modifier.

The modifier does not affect the solid's shape but its Tesselation

Note

The resulting mesh may not be isomorphic to the original one.

Example

 make subdiv( 0.5 ) >> box() 

Casts To

modifier

Parameters

maxlen

The absolute or projected maximum length the edges of the triangles of the mesh solid the modifier is applied to will have.

v1

Defines one projection direction for the edge comparison.

v2

Defines another projection direction for the edge comparison.