SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
transformation.h File Reference
#include <SketchUpAPI/geometry.h>

Go to the source code of this file.

Functions

SU_RESULT SUTransformationSetFromPointAndNormal (struct SUTransformation *transform, const struct SUPoint3D *point, const struct SUVector3D *normal)
 Sets the transformation based on the provided point and z-axis vector. The resulting transformation transforms points/vectors to a new coordinate system where the provided point is the new origin and the vector is the new z-axis. The other two axes in the transformed space are computed using the "Arbitrary axis algorithm". More...
 
SU_RESULT SUTransformationSetFromPointAndAxes (struct SUTransformation *transform, const struct SUPoint3D *point, const struct SUVector3D *x_axis, const struct SUVector3D *y_axis, const struct SUVector3D *z_axis)
 Sets the transformation based on the provided origin and axes. More...
 
SU_RESULT SUTransformationTranslation (struct SUTransformation *transform, const struct SUVector3D *vector)
 Creates a translation transformation using the given vector. More...
 
SU_RESULT SUTransformationScale (struct SUTransformation *transform, double scale)
 Creates a scale transformation using the given scale value. More...
 
SU_RESULT SUTransformationNonUniformScale (struct SUTransformation *transform, double x_scale, double y_scale, double z_scale)
 Creates a scale transformation using the given scale values. More...
 
SU_RESULT SUTransformationScaleAboutPoint (struct SUTransformation *transform, const struct SUPoint3D *point, double scale)
 Creates a scale transformation using the given scale value and origin. More...
 
SU_RESULT SUTransformationNonUniformScaleAboutPoint (struct SUTransformation *transform, const struct SUPoint3D *point, double x_scale, double y_scale, double z_scale)
 Creates a scale transformation using the given scale values and origin. More...
 
SU_RESULT SUTransformationRotation (struct SUTransformation *transform, const struct SUPoint3D *point, const struct SUVector3D *vector, double angle)
 Creates a transformation given an origin, vector of rotation, and angle. More...
 
SU_RESULT SUTransformationInterpolate (struct SUTransformation *transform, const struct SUTransformation *t1, const struct SUTransformation *t2, double weight)
 Performs an interpolation between two transformations. The weight determines the amount of interpolation. A weight of 0.0 would return a transformation of t1, while a weight of 1.0 would return a transformation of t2. More...
 
SU_RESULT SUTransformationIsIdentity (const struct SUTransformation *transform, bool *is_identity)
 Gets whether the transformation is an identity transformation. More...
 
SU_RESULT SUTransformationGetInverse (const struct SUTransformation *transform, struct SUTransformation *inverse)
 Gets the inverse transformation of the given transformation object. More...
 
SU_RESULT SUTransformationGetOrigin (const struct SUTransformation *transform, struct SUPoint3D *origin)
 Gets the origin point of the given transformation object. More...
 
SU_RESULT SUTransformationGetXAxis (const struct SUTransformation *transform, struct SUVector3D *x_axis)
 Gets the x axis vector of the given transformation object. More...
 
SU_RESULT SUTransformationGetYAxis (const struct SUTransformation *transform, struct SUVector3D *y_axis)
 Gets the y axis vector of the given transformation object. More...
 
SU_RESULT SUTransformationGetZAxis (const struct SUTransformation *transform, struct SUVector3D *z_axis)
 Gets the z_axis vector of the given transformation object. More...
 
SU_RESULT SUTransformationGetZRotation (const struct SUTransformation *transform, double *z_rotation)
 Gets the rotation about the z axis from the given transformation object. More...
 
SU_RESULT SUTransformationMultiply (const struct SUTransformation *transform1, const struct SUTransformation *transform2, struct SUTransformation *out_transform)
 Multiplies a transformation by another transformation. More...
 
SU_RESULT SUTransformationIsMirrored (const struct SUTransformation *transform, bool *is_mirrored)
 Returns true if transformation has been mirrored. More...
 

Function Documentation

SU_RESULT SUTransformationGetInverse ( const struct SUTransformation transform,
struct SUTransformation inverse 
)

Gets the inverse transformation of the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]inverseThe inverse transformation object.
Returns
SU_RESULT SUTransformationGetOrigin ( const struct SUTransformation transform,
struct SUPoint3D origin 
)

Gets the origin point of the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]originThe origin point to be retrieved.
Returns
SU_RESULT SUTransformationGetXAxis ( const struct SUTransformation transform,
struct SUVector3D x_axis 
)

Gets the x axis vector of the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]x_axisThe x axis vector to be retrieved.
Returns
SU_RESULT SUTransformationGetYAxis ( const struct SUTransformation transform,
struct SUVector3D y_axis 
)

Gets the y axis vector of the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]y_axisThe y axis vector to be retrieved.
Returns
SU_RESULT SUTransformationGetZAxis ( const struct SUTransformation transform,
struct SUVector3D z_axis 
)

Gets the z_axis vector of the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]z_axisThe z_axis vector to be retrieved.
Returns
SU_RESULT SUTransformationGetZRotation ( const struct SUTransformation transform,
double *  z_rotation 
)

Gets the rotation about the z axis from the given transformation object.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]z_rotationThe rotation to be retrieved.
Returns
SU_RESULT SUTransformationInterpolate ( struct SUTransformation transform,
const struct SUTransformation t1,
const struct SUTransformation t2,
double  weight 
)

Performs an interpolation between two transformations. The weight determines the amount of interpolation. A weight of 0.0 would return a transformation of t1, while a weight of 1.0 would return a transformation of t2.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe result of the interpolation.
[in]t1The first transformation object.
[in]t2The second transformation object.
[in]weightThe weight determines the amount of interpolation from t1 to t2.
Returns
SU_RESULT SUTransformationIsIdentity ( const struct SUTransformation transform,
bool *  is_identity 
)

Gets whether the transformation is an identity transformation.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation object.
[out]is_identityWhether the transformation is identity.
Returns
SU_RESULT SUTransformationIsMirrored ( const struct SUTransformation transform,
bool *  is_mirrored 
)

Returns true if transformation has been mirrored.

Since
SketchUp 2019, API 7.0
Parameters
[in]transformThe transform object.
[out]is_mirroredIndicates if mirrored.
Returns
SU_RESULT SUTransformationMultiply ( const struct SUTransformation transform1,
const struct SUTransformation transform2,
struct SUTransformation out_transform 
)

Multiplies a transformation by another transformation.

Since
SketchUp 2018, API 6.0
Parameters
[in]transform1The transformation object to be multiplied.
[in]transform2The transformation object to multiply by.
[out]out_transformThe result of the matrix multiplication [transform1 * transform2].
Returns
SU_RESULT SUTransformationNonUniformScale ( struct SUTransformation transform,
double  x_scale,
double  y_scale,
double  z_scale 
)

Creates a scale transformation using the given scale values.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]x_scaleThe x-axis scale value for the transformation.
[in]y_scaleThe y-axis scale value for the transformation.
[in]z_scaleThe z-axis scale value for the transformation.
Returns
SU_RESULT SUTransformationNonUniformScaleAboutPoint ( struct SUTransformation transform,
const struct SUPoint3D point,
double  x_scale,
double  y_scale,
double  z_scale 
)

Creates a scale transformation using the given scale values and origin.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]pointThe point specifying the translation component of the transformation.
[in]x_scaleThe x-axis scale value for the transformation.
[in]y_scaleThe y-axis scale value for the transformation.
[in]z_scaleThe z-axis scale value for the transformation.
Returns
SU_RESULT SUTransformationRotation ( struct SUTransformation transform,
const struct SUPoint3D point,
const struct SUVector3D vector,
double  angle 
)

Creates a transformation given an origin, vector of rotation, and angle.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe calculated transformation.
[in]pointThe point specifying the translation component of the transformation.
[in]vectorThe vector about which rotation will occur.
[in]angleThe rotation in radians for the transformation.
Returns
SU_RESULT SUTransformationScale ( struct SUTransformation transform,
double  scale 
)

Creates a scale transformation using the given scale value.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]scaleThe scale value for the transformation.
Returns
SU_RESULT SUTransformationScaleAboutPoint ( struct SUTransformation transform,
const struct SUPoint3D point,
double  scale 
)

Creates a scale transformation using the given scale value and origin.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]pointThe point specifying the translation component of the transformation.
[in]scaleThe scale value for the transformation.
Returns
SU_RESULT SUTransformationSetFromPointAndAxes ( struct SUTransformation transform,
const struct SUPoint3D point,
const struct SUVector3D x_axis,
const struct SUVector3D y_axis,
const struct SUVector3D z_axis 
)

Sets the transformation based on the provided origin and axes.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]pointThe point specifying the translation component of the transformation.
[in]x_axisThe 3D vector specifying the x-axis for the transformation. This is treated as a unit vector, so any scaling will be ignored.
[in]y_axisThe 3D vector specifying the y-axis for the transformation. This is treated as a unit vector, so any scaling will be ignored.
[in]z_axisThe 3D vector specifying the z-axis for the transformation. This is treated as a unit vector, so any scaling will be ignored.
Returns
SU_RESULT SUTransformationSetFromPointAndNormal ( struct SUTransformation transform,
const struct SUPoint3D point,
const struct SUVector3D normal 
)

Sets the transformation based on the provided point and z-axis vector. The resulting transformation transforms points/vectors to a new coordinate system where the provided point is the new origin and the vector is the new z-axis. The other two axes in the transformed space are computed using the "Arbitrary axis algorithm".

Since
SketchUp 2017, API 5.0
Parameters
[out]transformThe transformation to be set.
[in]pointThe point specifying the translation component of the transformation.
[in]normalThe 3D vector specifying the rotation component of the transformation. This is treated as a unit vector, so any scaling will be ignored.
Returns
SU_RESULT SUTransformationTranslation ( struct SUTransformation transform,
const struct SUVector3D vector 
)

Creates a translation transformation using the given vector.

Since
SketchUp 2018, API 6.0
Parameters
[out]transformThe transformation to be set.
[in]vectorThe 3D vector specifying the translation for the transformation.
Returns