Arithmetical and Vector Utilities
gpnt3d
gpnt2d
sdgpnt3dto2d
sdnumequalp
sddegtorad
sdradtodeg
sdvecnullp
sdvecequalp
sdveccolinearp
sdvecdirequalp
sdvecadd
sdvecsubtract
sdvecscale
sdvecnormalize
sdveccrossproduct
sdvecscalarproduct
sdveclength
sdvecanglebetween
sdvectranslate
sdvecrotate
sdvecxform
sddirrotate
sddirxform
sdboxpoints
GPNT3D [structure]
(makegpnt3d :x x
:y y
:z z)
(copygpnt3d gpnt3d)
(gpnt3dp gpnt3d)
(gpnt3d_x gpnt3d)
(gpnt3d_y gpnt3d)
(gpnt3d_z gpnt3d)
 Description:

The structure used to represent the x,y,z coordinates of a 3d point or
vector.
 Slots:

 x {LONGFLOAT [0.0]}  the x coordinate of the 3d
vector
 y {LONGFLOAT [0.0]}  the y coordinate of the 3d
vector
 z {LONGFLOAT [0.0]}  the z coordinate of the 3d
vector
GPNT2D [structure]
(makegpnt2d :x x :y y)
(copygpnt2d vec2d)
(gpnt2dp gpnt3d)
(gpnt2d_x vec2d)
(gpnt2d_y vec2d)
 Description:

The structure used to represent the x,y coordinates of a 2d point or
vector.
 Slots:

 x {LONGFLOAT [0.0]}  the x coordinate of the 2d
vector
 y {LONGFLOAT [0.0]}  the y coordinate of the 2d
vector
SDGPNT3DTO2D [function]
(sdgpnt3dto2d gpnt3d)
 Description:

Converts a GPNT3D (3D point or vector) to a GPNT2D by eliminating the z
component.
 Parameters:

 gpnt3d {GPNT3D}  the 3D point or vector
 Return value:

 gpnt2d {GPNT2D}  the gpnt2d
SDNUMEQUALP [function]
(sdnumequalp num1 num2 :resolution resolution)
 Description:

Checks if the two passed numbers are equal within the specified
geometric resolution.
 Parameters:

 num1 {NUMBER}
 The first number (integer of float) for the check.
 num2 {NUMBER}
 The second number (integer of float) for the check.
 :resolution {LONGFLOAT [Systemdefaultresolution]}
 The geometric resolution (or accuracy).
 Return value:

 t  if the absolute difference between both numbers is less
than resolution
 nil  otherwise
SDDEGTORAD [macro]
(sddegtorad angle)
 Description:

Converts an angle given in degree to an angle in radians.
 Parameters:

 angle {LONGFLOAT}  the angle in degree
 Return value:

 angle {LONGFLOAT}  the angle in radians
SDRADTODEG [macro]
(sdradtodeg angle)
 Description:

Converts an angle given in radians to an angle in degree.
 Parameters:

 angle {LONGFLOAT}  the angle in radians
 Return value:

 angle {LONGFLOAT}  the angle in degree
SDVECNULLP [function]
(sdvecnullp vector
:resolution resolution)
 Description:

Checks if a vector is equivalent to the null vector (0,0 or 0,0,0)
within the specified geometric resolution (or the default resolution of
1e6). Note that the default resolution is a fixed constant, and is not
affected by the system setting for default geometric resolution.
 Parameters:

 vector {GPNT3D or GPNT2D}
 The vector to check against the null vector.

 :resolution {NUMBER [1e6]}
 The geometric resolution (or accuracy).
 Return value:
 t  if the vector is null
 nil  if the vector is not null
SDVECEQUALP [function]
(sdvecequalp vector1 vector2
:resolution resolution)
 Description:

Checks if the difference between two vectors is equivalent to the null
vector (0,0 or 0,0,0) within the specified geometric resolution (or the
default resolution of 1e6). Note that the default resolution is a fixed
constant, and is not affected by the system setting for default
geometric resolution.
 Parameters:

 vector1 and vector2 {GPNT3D or GPNT2D}
 The vectors to compare. If the vectors are not of the same type,
then the GPNT2D vector is treated as a GPNT3D vector with a zero value
Zcoordinate.
 :resolution {NUMBER [1e6]}
 The geometric resolution (accuracy).
 Return value:
 t  if the vectors are equal

nil  if the vectors are not equal
 See Also:
 sdinqdefaultgeoresolution
 sdinqpartgeoresolution
SDVECCOLINEARP [function]
(sdveccolinearp vector1 vector2)
 Description:

Checks if two vectors are colinear.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 The vectors to compare. If the vectors are not of the same type,
then the GPNT2D vector is treated as a GPNT3D vector with a zero value
Zcoordinate.
 Return value:
 t  if the vectors are colinear
 nil  if the vectors are not colinear
SDVECDIREQUALP [function]
(sdvecdirequalp vector1 vector2)
 Description:

Checks if the direction of the passed vectors is the same.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 The vectors to compare. If the vectors are not of the same type,
then the GPNT2D vector is treated as a GPNT3D vector with a zero value
Zcoordinate.
 Return value:
 t  if the vectors have the same direction
 nil  if the vectors have different directions
SDVECADD [function]
(sdvecadd vector1 vector2)
 Description:

Adds two vectors.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 The vectors to add. If the vectors are not of the same type, then
the GPNT2D vector is treated as a GPNT3D vector with a zero value
Zcoordinate.
 Return value:
 sum {GPNT2D or GPNT3D}  The sum of vector1 and vector2
SDVECSUBTRACT [function]
(sdvecsubtract vector1 vector2)
 Description:

Subtracts vector2 from vector1.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 The vectors to subtract. If the vectors are not of the same type,
then the GPNT2D vector is treated as a GPNT3D vector with a zero value
Zcoordinate.
 Return value:

 difference {GPNT2D or GPNT3D}
 The subtraction of vector2 from vector1 (in other
words, the direction vector pointing from vector2 to vector1).
SDVECSCALE [function]
(sdvecscale vector scalar)
 Description:

Multiplies each component of vector by scalar.
 Parameters:

 vector {GPNT2D or GPNT3D}
 The vector to scale.
 scalar {NUMBER}
 The scaling factor.
 Return value:

 dot product {GPNT2D or GPNT3D}
 The result of multiplying each component of vector by
scalar
SDVECNORMALIZE [function]
(sdvecnormalize vector)
 Description:

Converts vector to a unit vector (i.e. scales it such that it's
length equals 1.0).
 Parameters:

 vector {GPNT2D or GPNT3D}  must NOT be a null vector!
 The vector to normalize.
 Return value:

 normalized vector{GPNT2D or GPNT3D}  The normalized
vector.
SDVECCROSSPRODUCT [function]
(sdveccrossproduct vector1 vector2)
 Description:

Calculates the cross product of vector1 and vector2.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 The vectors to cross.
 Return value:

 cross product {GPNT3D}  The cross product.
SDVECSCALARPRODUCT [function]
(sdvecscalarproduct vector1 vector2)
 Description:

Calculates the scalar product of vector1 and vector2.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}
 Return value:

 scalar product {LONGFLOAT}  The scalar product.
SDVECLENGTH [function]
(sdveclength vector)
 Description:

Calculates the length of vector.
 Parameters:

 vector {GPNT2D or GPNT3D}
 Return value:

 length {LONGFLOAT}
SDVECANGLEBETWEEN [function]
(sdvecanglebetween vector1 vector2)
 Description:

Calculates the angle (in radians) from vector1 to vector2.
The sense of the angle is such that vector1 can be made colinear
with vector2 if rotated by angle about the axis given by
the cross product vector1 x vector2.
If both vectors are 2D vectors the resulting angle is in the range
between 0 and 2pi. In this special case there is no need to calculate
the cross product.
 Parameters:

 vector1 and vector2 {GPNT2D or GPNT3D}  neither may
be a null vector!
 Return value:

 angle {LONGFLOAT}  the angle in radians
SDVECTRANSLATE [function]
(sdvectranslate vector direction length)
 Description:

Translates vector in the direction direction about
length.
 Parameters:

 vector {GPNT3D}  the vector to translate
 direction {GPNT3D}  the translation direction
 length {LONGFLOAT}  the amount to translate
 Return value:

 vector {GPNT3D}  the translated vector
SDVECROTATE [function]
(sdvecrotate vector angle :point point :direction direction)
 Description:

Rotates vector around the axis specified though :point and
:direction about angle.
 Parameters:

 vector {GPNT3D}  the vector to rotate
 angle {LONGFLOAT}  the rotation angle in radians
 :point {GPNT3D [0,0,0]}  a point on the rotation axis
 :direction {GPNT3D}  the direction of the rotation
axis
 Return value:

 vector {GPNT3D}  the rotated vector
SDVECXFORM [function]
(sdvecxform vector :sourcespace sourcespace :destspace destspace)
 Description:

Transforms a vector specified in the sourcespace
coordinate system into the destspace coordinate system.
 Parameters:

 vector {GPNT2D or GPNT3D}  the vector to transform
 :sourcespace {KEYWORD or SEL_ITEM}  the source coordinate
system

 :global  vector is defined in the global
coordinate system
 SEL_ITEM  Represents either an object or an element.
vector is defined in the coordinate system of the object or
part/workplane owning the element.
 :destspace {KEYWORD or SEL_ITEM [:global]}  the
destination coordinate system

 :global  vector will be transformed into the
global coordinate system
 SEL_ITEM  Represents either an object or an element.
vector is transformed into the coordinate system of the
object or part/workplane owning the element.
 Return value:

 vector {GPNT3D}  the transformed vector
SDDIRROTATE [function]
(sddirrotate direction angle :point point :direction direction)
 Description:

Rotates direction around the axis specified though :point
and :direction about angle.
 Parameters:

 direction {GPNT3D}  the direction vector to rotate
 angle {LONGFLOAT}  the rotation angle in radians
 :point {GPNT3D [0,0,0]}  a point on the rotation axis
 :direction {GPNT3D}  the direction of the rotation
axis
 Return value:

 direction {GPNT3D}  the rotated direction vector
SDDIRXFORM [function]
(sddirxform direction :sourcespace sourcespace :destspace destspace)
 Description:

Transforms a direction vector specified in the
sourcespace coordinate system into the destspace
coordinate system.
 Parameters:

 direction {GPNT2D or GPNT3D}  the direction vector to
transform
 :sourcespace {KEYWORD or SEL_ITEM}  the source coordinate
system

 :global  the direction vector is defined in the
global coordinate system
 SEL_ITEM  Represents either an object or an element.
The direction vector is defined in the coordinate system of
the object or part/workplane owning the element.
 :destspace {KEYWORD or SEL_ITEM [:global]}  the
destination coordinate system

 :global  the direction vector will be
transformed into the global coordinate system
 SEL_ITEM  Represents either an object or an element.
The direction vector is transformed into the coordinate
system of the object or part/workplane owning the element.
 Return value:

 direction {GPNT3D}  the transformed direction vector
SDBOXPOINTS [function]
(sdboxpoints lowerleft upperright zdir xdir)
 Description:

Calculate the corner points of a box given by the lower left and upper
right point and the axis directions x, y, z, where x is given by xdir,
y by the cross product of z and x and z is given by zdir
 Parameters:

 lowerleft {GPNT3D}  the lower left point of the box
 upperright {GPNT3D}  the upper right point of the
box
 zdir {GPNT3D}  the z direction of the box
 xdir {GPNT3D}  the x direction of the box
 Return value:

 result {LIST}  a list containing the 8 corner points of
the box as described in SDSTARTBOXFEEDBACK, so
that the result can directly be used by the feedback function
© 2019 Parametric
Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved 