Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::MarkerOrient Struct Reference

Represents the orientation of a marker. More...

#include "donner/svg/core/MarkerOrient.h"

Public Types

enum class  Type : uint8_t {
  Angle ,
  Auto ,
  AutoStartReverse
}
 The type of the orientation. More...
 
enum class  MarkerType : uint8_t {
  Default ,
  Start
}
 For computeAngleRadians, to specify if this is the marker-start orientation. More...
 

Public Member Functions

 MarkerOrient ()=default
 Default constructor.
 
 ~MarkerOrient ()=default
 Destructor.
 
 MarkerOrient (const MarkerOrient &)=default
 Copy constructor.
 
 MarkerOrient (MarkerOrient &&)=default
 Move constructor.
 
MarkerOrientoperator= (const MarkerOrient &)=default
 Copy assignment operator.
 
MarkerOrientoperator= (MarkerOrient &&)=default
 Move assignment operator.
 
Type type () const
 Returns the type of orientation.
 
double computeAngleRadians (const Vector2d &direction, MarkerType markerType=MarkerType::Default) const
 Computes the angle in radians based on the direction vector and the type of orientation.
 
bool operator== (const MarkerOrient &other) const
 

Static Public Member Functions

static MarkerOrient AngleRadians (double angleRadians)
 Creates a new orientation with a user-provided angle in radians.
 
static MarkerOrient AngleDegrees (double angleDegrees)
 Creates a new orientation with a user-provided angle in radians.
 
static MarkerOrient Auto ()
 Creates a new orientation that computes the angle from the direction vector.
 
static MarkerOrient AutoStartReverse ()
 Creates a new orientation that computes the angle from the direction vector, but reverses the direction for marker-start.
 

Detailed Description

Represents the orientation of a marker.

Member Enumeration Documentation

◆ MarkerType

For computeAngleRadians, to specify if this is the marker-start orientation.

Enumerator
Default 

The default orientation.

Start 

The marker-start orientation.

◆ Type

The type of the orientation.

Enumerator
Angle 

Contains a user-provided angle.

Auto 

The angle is computed from the direction vector.

AutoStartReverse 

Like Auto, but for marker-start the direction is reversed.

Member Function Documentation

◆ AngleDegrees()

static MarkerOrient donner::svg::MarkerOrient::AngleDegrees ( double angleDegrees)
inlinestatic

Creates a new orientation with a user-provided angle in radians.

Parameters
angleDegreesThe angle in Degrees.
Returns
The new orientation.

◆ AngleRadians()

static MarkerOrient donner::svg::MarkerOrient::AngleRadians ( double angleRadians)
inlinestatic

Creates a new orientation with a user-provided angle in radians.

Parameters
angleRadiansThe angle in radians.
Returns
The new orientation.

◆ Auto()

static MarkerOrient donner::svg::MarkerOrient::Auto ( )
inlinestatic

Creates a new orientation that computes the angle from the direction vector.

Returns
The new orientation.

◆ AutoStartReverse()

static MarkerOrient donner::svg::MarkerOrient::AutoStartReverse ( )
inlinestatic

Creates a new orientation that computes the angle from the direction vector, but reverses the direction for marker-start.

Returns
The new orientation.

◆ computeAngleRadians()

double donner::svg::MarkerOrient::computeAngleRadians ( const Vector2d & direction,
MarkerType markerType = MarkerType::Default ) const
inline

Computes the angle in radians based on the direction vector and the type of orientation.

Parameters
directionThe direction vector.
markerTypeSet to MarkerType::Start if this is the marker-start orientation.
Returns
The angle in radians.

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