Dice3DS.util Namespace Reference

Functions

def calculate_normals_by_angle_subtended (pointarray, facearray, smarray)
 
def calculate_normals_by_cross_product (pointarray, facearray, smarray)
 
def calculate_normals_no_smoothing (pointarray, facearray, smarray=None)
 
def translate_points (pointarray, matrix)
 

Variables

 xrange = range
 

Function Documentation

◆ calculate_normals_by_angle_subtended()

def Dice3DS.util.calculate_normals_by_angle_subtended (   pointarray,
  facearray,
  smarray 
)
Calculate normals by smoothing, weighting by angle subtended.

    points,norms = calculate_normals_by_angle_subtended(
            pointarray,facearray,smarray)

Takes an array of points, faces, and a smoothing group in exactly
the same form in which they appear in the 3DS DOM.

Returns a numpy.array of points, one per row, and a numpy.array of
the corresponding normals.  The points are returned as a list of
consecutive triangles; the first three rows make up the first
triangle, the second three rows make up the second triangle, and
so on.

To calculate the normal of a given vertex on a given face, this
function averages the normal vector for all faces which have share
that vertex, and a smoothing group.

The normals being averaged are weighted by the angle subtended.

References Dice3DS.util.calculate_normals_by_angle_subtended(), and Dice3DS.util.xrange.

Referenced by Dice3DS.util.calculate_normals_by_angle_subtended().

◆ calculate_normals_by_cross_product()

def Dice3DS.util.calculate_normals_by_cross_product (   pointarray,
  facearray,
  smarray 
)
Calculate normals by smoothing, weighting by cross-product.

    points,norms = calculate_normals_by_cross_product(
            pointarray,facearray,smarray)

Takes an array of points, faces, and a smoothing group in exactly
the same form in which they appear in the 3DS DOM.

Returns a numpy.array of points, one per row, and a numpy.array of
the corresponding normals.  The points are returned as a list of
consecutive triangles; the first three rows make up the first
triangle, the second three rows make up the second triangle, and
so on.

To calculate the normal of a given vertex on a given face, this
function averages the normal vector for all faces which have share
that vertex and a smoothing group.

The normals being averaged are weighted by the cross-product used
to obtain the face's normal, which is proportional to the area of
the face.

References Dice3DS.util.calculate_normals_by_cross_product(), and Dice3DS.util.xrange.

Referenced by Dice3DS.util.calculate_normals_by_cross_product().

◆ calculate_normals_no_smoothing()

def Dice3DS.util.calculate_normals_no_smoothing (   pointarray,
  facearray,
  smarray = None 
)
Calculate normals all perpendicular to the faces.

    points,norms = calculate_normals_no_smoothing(
            pointarray,facearray,smarray=None)

Takes an array of points and faces in exactly the same form in
which they appear in the 3DS DOM.  It accepts a smoothing array,
but ignores it.

Returns a numpy.array of points, one per row, and a
numpy.array of the corresponding normals.  The points are
returned as a list of consecutive triangles; the first three rows
make up the first triangle, the second three rows make up the
second triangle, and so on.

The normal vectors are determined by calculating the normal to
each face.  There is no smoothing.

References Dice3DS.util.calculate_normals_no_smoothing().

Referenced by Dice3DS.util.calculate_normals_no_smoothing().

◆ translate_points()

def Dice3DS.util.translate_points (   pointarray,
  matrix 
)
Translate points in pointarray by the given matrix.

    tpointarray = translate_points(pointarray,matrix)

Takes array of points and a homogeneous (4D) transformation
matrix in exactly the same form in which they appear in the
3DS DOM.

Returns a pointarray with the points transformed by the matrix.

References Dice3DS.util.translate_points().

Referenced by Dice3DS.util.translate_points().

Variable Documentation

◆ xrange