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

3D unit-direction value type. Mirrors occtl_direction3_t. More...

#include <geom.hpp>

Public Member Functions

 Direction3 (const occtl_direction3_t &theC) noexcept
 Wraps an existing C value type (zero-cost). Caller guarantees unit norm.
 
const occtl_direction3_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 z () const noexcept
 Z component (unit-normalised).
 
double dot (const Direction3 &theOther) const noexcept
 Dot product. Returns a value in [-1, 1]. Never throws.
 
Vector3 cross (const Direction3 &theOther) const noexcept
 Cross product as a free vector. Zero for parallel/anti-parallel inputs.
 
double angle (const Direction3 &theOther) const noexcept
 Angle in radians, in [0, π]. Never throws.
 
Direction3 reversed () const noexcept
 Returns this direction negated. Never throws.
 

Static Public Member Functions

static Direction3 from_vector (const Vector3 &theV)
 Builds a normalised direction from a vector.
 

Detailed Description

3D unit-direction value type. Mirrors occtl_direction3_t.

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

Member Function Documentation

◆ from_vector()

static Direction3 occtl::Direction3::from_vector ( const Vector3 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: