SketchUp C API

- Main Page
- Related Pages
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Fields | Related Functions
SUVector2D Struct Reference

Represents a vector in 2-dimensional space. The magnitudes are represented in inches. More...

`#include <SketchUpAPI/geometry.h>`

## Data Fields
double | x
| X magnitude.
double | y
| Y magnitude.

## Related Functions
(Note that these are not member functions.)
enum SUResult | SUVector2DCreate (struct SUVector2D *vector, const struct SUPoint2D *from, const struct SUPoint2D *to)
| Creates a vector between two point objects. More...
enum SUResult | SUVector2DIsValid (const struct SUVector2D *vector, bool *valid)
| Determines if a vector is valid. A vector is invalid if its length is zero. More...
enum SUResult | SUVector2DIsParallelTo (const struct SUVector2D *vector1, const struct SUVector2D *vector2, bool *parallel)
| Determines if two vectors are parallel. More...
enum SUResult | SUVector2DIsPerpendicularTo (const struct SUVector2D *vector1, const struct SUVector2D *vector2, bool *perpendicular)
| Determines if two vectors are perpendicular. More...
enum SUResult | SUVector2DIsSameDirectionAs (const struct SUVector2D *vector1, const struct SUVector2D *vector2, bool *same_direction)
| Determines if two vectors are parallel and pointing the same direction. More...
enum SUResult | SUVector2DIsEqual (const struct SUVector2D *vector1, const struct SUVector2D *vector2, bool *equal)
| Determines if two vectors are equal. More...
enum SUResult | SUVector2DNormalize (struct SUVector2D *vector)
| Normalizes a vector. More...
enum SUResult | SUVector2DReverse (struct SUVector2D *vector)
| Reverses a vector. More...
enum SUResult | SUVector2DDot (const struct SUVector2D *vector1, const struct SUVector2D *vector2, double *dot)
| Computes the dot product of two vectors. More...
enum SUResult | SUVector2DCross (const struct SUVector2D *vector1, const struct SUVector2D *vector2, double *cross)
| Computes the cross product of two vectors. More...
enum SUResult | SUVector2DIsUnitVector (const struct SUVector2D *vector, bool *is_unit_vector)
| Determines if a vector has a length of one. More...
enum SUResult | SUVector2DGetLength (const struct SUVector2D *vector, double *length)
| Gets the length of a vector, in inches. More...
enum SUResult | SUVector2DSetLength (struct SUVector2D *vector, double length)
| Sets the length of a vector, in inches. More...
enum SUResult | SUVector2DAngleBetween (const struct SUVector2D *vector1, const struct SUVector2D *vector2, double *angle)
| Gets the angle between two vectors. More...
enum SUResult | SUVector2DTransform (const struct SUTransformation2D *transform, struct SUVector2D *vector)
| Transforms a vector by applying a 2D transformation. More...

## Detailed Description

Represents a vector in 2-dimensional space. The magnitudes are represented in inches.

## Friends And Related Function Documentation

enum SUResult SUVector2DAngleBetween | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | double * | angle
| ) |  |
| related

Gets the angle between two vectors.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | angle | The angle between the vectors.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if angle is NULL

enum SUResult SUVector2DCreate | ( | struct SUVector2D * | vector,
|  | const struct SUPoint2D * | from,
|  | const struct SUPoint2D * | to
| ) |  |
| related

Creates a vector between two point objects.

Since
  SketchUp 2018 M0, API 6.0

Parameters

  [in] | from | The first point object.
  [in] | to | The second point object.
  [out] | vector | The vector from from to to.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if from or to is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if vector is NULL

enum SUResult SUVector2DCross | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | double * | cross
| ) |  |
| related

Computes the cross product of two vectors.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | cross | The value of the cross product.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if cross is NULL

enum SUResult SUVector2DDot | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | double * | dot
| ) |  |
| related

Computes the dot product of two vectors.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | dot | The value of the dot product.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if dot is NULL

enum SUResult SUVector2DGetLength | ( | const struct SUVector2D * | vector,
|  | double * | length
| ) |  |
| related

Gets the length of a vector, in inches.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector | The vector object.
  [out] | length | The length of the vector, in inches.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if length is NULL

enum SUResult SUVector2DIsEqual | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | bool * | equal
| ) |  |
| related

Determines if two vectors are equal.

Since
  SketchUp 2018, API 6.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | equal | Whether the vectors are equal.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if equal is NULL

enum SUResult SUVector2DIsParallelTo | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | bool * | parallel
| ) |  |
| related

Determines if two vectors are parallel.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | parallel | Whether the vectors are parallel.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if parallel is NULL
  - SU_ERROR_INVALID_ARGUMENT if vector1 or vector2 is not a valid vector

enum SUResult SUVector2DIsPerpendicularTo | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | bool * | perpendicular
| ) |  |
| related

Determines if two vectors are perpendicular.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | perpendicular | Whether the vectors are perpendicular.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if perpendicular is NULL
  - SU_ERROR_INVALID_ARGUMENT if vector1 or vector2 is not a valid vector

enum SUResult SUVector2DIsSameDirectionAs | ( | const struct SUVector2D * | vector1,
|  | const struct SUVector2D * | vector2,
|  | bool * | same_direction
| ) |  |
| related

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

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector1 | The first vector object.
  [in] | vector2 | The second vector object.
  [out] | same_direction | Whether the vectors are pointing in the same direction.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector1 or vector2 is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if same_direction is NULL
  - SU_ERROR_INVALID_ARGUMENT if vector1 or vector2 is not a valid vector

enum SUResult SUVector2DIsUnitVector | ( | const struct SUVector2D * | vector,
|  | bool * | is_unit_vector
| ) |  |
| related

Determines if a vector has a length of one.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector | The vector object.
  [out] | is_unit_vector | Whether the vector has a length of one.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if is_unit_vector is NULL

enum SUResult SUVector2DIsValid | ( | const struct SUVector2D * | vector,
|  | bool * | valid
| ) |  |
| related

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

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | vector | The vector object.
  [out] | valid | Whether the vector is valid.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if valid is NULL

enum SUResult SUVector2DNormalize | ( | struct SUVector2D * | vector | ) |
| related

Normalizes a vector.

Since
  SketchUp 2017, API 5.0

Parameters

  [in,out] | vector | The vector object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL
  - SU_ERROR_INVALID_ARGUMENT if vector is not a valid vector

enum SUResult SUVector2DReverse | ( | struct SUVector2D * | vector | ) |
| related

Reverses a vector.

Since
  SketchUp 2017, API 5.0

Parameters

  [in,out] | vector | The vector object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL

enum SUResult SUVector2DSetLength | ( | struct SUVector2D * | vector,
|  | double | length
| ) |  |
| related

Sets the length of a vector, in inches.

Since
  SketchUp 2017, API 5.0

Parameters

  [in,out] | vector | The vector object.
  [in] | length | The new length the vector should be, in inches.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if vector is NULL
  - SU_ERROR_OUT_OF_RANGE if length is zero
  - SU_ERROR_INVALID_ARGUMENT if vector is not a valid vector

enum SUResult SUVector2DTransform | ( | const struct SUTransformation2D * | transform,
|  | struct SUVector2D * | vector
| ) |  |
| related

Transforms a vector by applying a 2D transformation.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | transform | The transformation to be applied.
  [in,out] | vector | The vector to be transformed.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if transform is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if vector is NULL

The documentation for this struct was generated from the following files:

- SketchUpAPI/geometry.h
- SketchUpAPI/geometry/vector2d.h