OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl::Vector2 Struct Reference

2D free-vector value type. Mirrors occtl_vector2_t. More...

#include <geom.hpp>

Public Member Functions

 Vector2 () noexcept
 Default-constructs the zero vector.
 
 Vector2 (const double theX, const double theY) noexcept
 Constructs from explicit components.
 
 Vector2 (const occtl_vector2_t &theC) noexcept
 Wraps an existing C value type (zero-cost).
 
const occtl_vector2_tc_type () const noexcept
 Borrows-it view of the underlying C value type.
 
double x () const noexcept
 X component.
 
double y () const noexcept
 Y component.
 
double dot (const Vector2 &theOther) const noexcept
 Dot product with another vector. Never throws.
 
double cross (const Vector2 &theOther) const noexcept
 Signed scalar cross product (Z-component). Never throws.
 
double magnitude () const noexcept
 Euclidean length. Never throws.
 
Vector2 normalized () const
 Returns this vector normalised to unit length.
 

Detailed Description

2D free-vector value type. Mirrors occtl_vector2_t.

Member Function Documentation

◆ normalized()

Vector2 occtl::Vector2::normalized ( ) const
inline

Returns this vector normalised to unit length.

Exceptions
Errorwith code OCCTL_GEOMETRY_INVALID when this vector has zero length.

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