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

2D unit-direction value type. Mirrors occtl_direction2_t. More...

#include <geom.hpp>

Public Member Functions

 Direction2 (const occtl_direction2_t &theC) noexcept
 Wraps an existing C value type (zero-cost). Caller guarantees unit norm.
 
const occtl_direction2_tc_type () const noexcept
 Borrows-it view of the underlying C value type.
 
double x () const noexcept
 X component (unit-normalised).
 
double y () const noexcept
 Y component (unit-normalised).
 
double angle (const Direction2 &theOther) const noexcept
 Angle in radians between this and theOther, in [0, π]. Never throws.
 

Static Public Member Functions

static Direction2 from_vector (const Vector2 &theV)
 Builds a normalised direction from a vector.
 

Detailed Description

2D unit-direction value type. Mirrors occtl_direction2_t.

There is no default constructor: a default direction is not meaningful. Use from_vector to build one from a non-zero Vector2.

Member Function Documentation

◆ from_vector()

static Direction2 occtl::Direction2::from_vector ( const Vector2 theV)
inlinestatic

Builds a normalised direction from a vector.

Exceptions
Errorwith code OCCTL_GEOMETRY_INVALID when theV has zero length.

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