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

Go to the source code of this file.

Functions

SU_RESULT SUVector3DCreate (struct SUVector3D *vector, const struct SUPoint3D *from, const struct SUPoint3D *to)
 Creates a vector between two point objects. More...
 
SU_RESULT SUVector3DIsValid (const struct SUVector3D *vector, bool *valid)
 Determines if a vector is valid. A vector is invalid if its length is zero. More...
 
SU_RESULT SUVector3DIsParallelTo (const struct SUVector3D *vector1, const struct SUVector3D *vector2, bool *parallel)
 Determines if two vectors are parallel. More...
 
SU_RESULT SUVector3DIsPerpendicularTo (const struct SUVector3D *vector1, const struct SUVector3D *vector2, bool *perpendicular)
 Determines if two vectors are perpendicular. More...
 
SU_RESULT SUVector3DIsSameDirectionAs (const struct SUVector3D *vector1, const struct SUVector3D *vector2, bool *same_direction)
 Determines if two vectors are parallel and pointing the same direction. More...
 
SU_RESULT SUVector3DIsEqual (const struct SUVector3D *vector1, const struct SUVector3D *vector2, bool *equal)
 Determines if two vectors are equal. More...
 
SU_RESULT SUVector3DLessThan (const struct SUVector3D *vector1, const struct SUVector3D *vector2, bool *less_than)
 Determines if vector1 is less than vector2. More...
 
SU_RESULT SUVector3DNormalize (struct SUVector3D *vector)
 Normalizes a vector. More...
 
SU_RESULT SUVector3DReverse (struct SUVector3D *vector)
 Reverses a vector. More...
 
SU_RESULT SUVector3DDot (const struct SUVector3D *vector1, const struct SUVector3D *vector2, double *dot)
 Computes the dot product of two vectors. More...
 
SU_RESULT SUVector3DCross (const struct SUVector3D *vector1, const struct SUVector3D *vector2, struct SUVector3D *cross)
 Computes the cross product of two vectors. More...
 
SU_RESULT SUVector3DIsUnitVector (const struct SUVector3D *vector, bool *is_unit_vector)
 Determines if a vector has a length of one. More...
 
SU_RESULT SUVector3DGetLength (const struct SUVector3D *vector, double *length)
 Gets the length of a vector. More...
 
SU_RESULT SUVector3DSetLength (struct SUVector3D *vector, double length)
 Sets the length of a vector. More...
 
SU_RESULT SUVector3DAngleBetween (const struct SUVector3D *vector1, const struct SUVector3D *vector2, double *angle)
 Gets the angle between two vectors. More...
 
SU_RESULT SUVector3DGetArbitraryAxes (const struct SUVector3D *z_axis, struct SUVector3D *x_axis, struct SUVector3D *y_axis)
 Get arbitrary axes perpendicular to this vector. This method uses the arbitrary axis algorithm to calculate the x and y vectors. More...
 
SU_RESULT SUVector3DTransform (const struct SUTransformation *transform, struct SUVector3D *vector)
 Transforms the provided 3D vector by applying the provided 3D transformation. More...
 
SU_RESULT SUVector3DLinearCombination (const struct SUVector3D *vectors, const double *weights, const size_t size, struct SUVector3D *vector)
 Creates a new vector as a linear combination of other vectors. This method is generally used to get a vector at some percentage between two vectors. More...
 

Function Documentation

SU_RESULT SUVector3DAngleBetween ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
double *  angle 
)

Gets the angle between two vectors.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]angleThe angle between the vectors.
Returns
SU_RESULT SUVector3DCreate ( struct SUVector3D vector,
const struct SUPoint3D from,
const struct SUPoint3D to 
)

Creates a vector between two point objects.

Since
SketchUp 2018, API 6.0
Parameters
[in]fromThe first point object.
[in]toThe second point object.
[out]vectorThe vector from from to to.
Returns
SU_RESULT SUVector3DCross ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
struct SUVector3D cross 
)

Computes the cross product of two vectors.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]crossThe value of the cross product.
Returns
SU_RESULT SUVector3DDot ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
double *  dot 
)

Computes the dot product of two vectors.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]dotThe value of the dot product.
Returns
SU_RESULT SUVector3DGetArbitraryAxes ( const struct SUVector3D z_axis,
struct SUVector3D x_axis,
struct SUVector3D y_axis 
)

Get arbitrary axes perpendicular to this vector. This method uses the arbitrary axis algorithm to calculate the x and y vectors.

Parameters
[in]z_axisThe vector to use as the z axis.
[out]x_axisThe computed x axis vector.
[out]y_axisThe computed y axis vector.
Returns
SU_RESULT SUVector3DGetLength ( const struct SUVector3D vector,
double *  length 
)

Gets the length of a vector.

Since
SketchUp 2018, API 6.0
Parameters
[in]vectorThe vector object.
[out]lengthThe length of the vector.
Returns
SU_RESULT SUVector3DIsEqual ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
bool *  equal 
)

Determines if two vectors are equal.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]equalWhether the vectors are equal.
Returns
SU_RESULT SUVector3DIsParallelTo ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
bool *  parallel 
)

Determines if two vectors are parallel.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]parallelWhether the vectors are parallel.
Returns
SU_RESULT SUVector3DIsPerpendicularTo ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
bool *  perpendicular 
)

Determines if two vectors are perpendicular.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]perpendicularWhether the vectors are perpendicular.
Returns
SU_RESULT SUVector3DIsSameDirectionAs ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
bool *  same_direction 
)

Determines if two vectors are parallel and pointing the same direction.

Since
SketchUp 2018, API 6.0
Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]same_directionWhether the vectors are pointing in the same direction.
Returns
SU_RESULT SUVector3DIsUnitVector ( const struct SUVector3D vector,
bool *  is_unit_vector 
)

Determines if a vector has a length of one.

Since
SketchUp 2018, API 6.0
Parameters
[in]vectorThe vector object.
[out]is_unit_vectorWhether the vector has a length of one.
Returns
SU_RESULT SUVector3DIsValid ( const struct SUVector3D vector,
bool *  valid 
)

Determines if a vector is valid. A vector is invalid if its length is zero.

Since
SketchUp 2018, API 6.0
Parameters
[in]vectorThe vector object.
[out]validWhether the vector is valid.
Returns
SU_RESULT SUVector3DLessThan ( const struct SUVector3D vector1,
const struct SUVector3D vector2,
bool *  less_than 
)

Determines if vector1 is less than vector2.

Parameters
[in]vector1The first vector object.
[in]vector2The second vector object.
[out]less_thanWhether vector1 is less than vector2.
Returns
SU_RESULT SUVector3DLinearCombination ( const struct SUVector3D vectors,
const double *  weights,
const size_t  size,
struct SUVector3D vector 
)

Creates a new vector as a linear combination of other vectors. This method is generally used to get a vector at some percentage between two vectors.

Since
SketchUp 2018, API 6.0
Parameters
[in]vectorsAn array of vectors. Must be size of 2 or 3.
[in]weightsAn array of weights that correspond to the percentage. Must be the same size as vectors.
[in]sizeThe size of the vectors and weights array.
[out]vectorThe new computed vector.
Returns
SU_RESULT SUVector3DNormalize ( struct SUVector3D vector)

Normalizes a vector.

Since
SketchUp 2018, API 6.0
Parameters
[in,out]vectorThe vector object.
Returns
SU_RESULT SUVector3DReverse ( struct SUVector3D vector)

Reverses a vector.

Since
SketchUp 2018, API 6.0
Parameters
[in,out]vectorThe vector object.
Returns
SU_RESULT SUVector3DSetLength ( struct SUVector3D vector,
double  length 
)

Sets the length of a vector.

Since
SketchUp 2018, API 6.0
Parameters
[in,out]vectorThe vector object.
[in]lengthThe new length the vector should be.
Returns
SU_RESULT SUVector3DTransform ( const struct SUTransformation transform,
struct SUVector3D vector 
)

Transforms the provided 3D vector by applying the provided 3D transformation.

Since
SketchUp 2018, API 6.0
Parameters
[in]transformThe transformation to be applied.
[in,out]vectorThe vector to be transformed.
Returns