Rumba C++ SDK
maquina::MatrixCurve Class Reference

A Matrix curve value. More...

#include <MatrixCurve.h>

Inheritance diagram for maquina::MatrixCurve:
maquina::Shape maquina::Value

Public Types

enum  MainAxis {
  MainAxis::X = 0, MainAxis::Y = 1, MainAxis::Z = 2, MainAxis::MX = 3,
  MainAxis::MY = 4, MainAxis::MZ = 5
}
 < Set the control matrix axis used to define the curve More...
 
enum  CurveType { CurveType::ConstrainedBezier = 0, CurveType::Bezier, CurveType::Spline }
 
enum  OrientationMode { OrientationMode::Free = 0, OrientationMode::Constrained }
 
- Public Types inherited from maquina::Shape
enum  Topology { constant =0, vertex, face, face_varying }
 The different attribute topologies. More...
 

Public Member Functions

Construction
 MatrixCurve ()
 Create an empty curve. More...
 
 MatrixCurve (const BufferConstM44d &matrices, CurveType type, OrientationMode mode, MainAxis main_axis=MainAxis::X)
 Create a curve. More...
 
 MatrixCurve (const Value &v)
 Cast a Value in NurbsCurve. More...
 
Access
const BufferConstM44d read_matrices () const
 Return the readable curve matrices. More...
 
BufferM44d write_matrices ()
 Return the writable curve matrices. More...
 
CurveType type () const
 
OrientationMode mode () const
 
MainAxis main_axis () const
 
Evaluation
Imath::M44d evaluate (double u) const
 Evaluate the curve at a u coordinate, oriented along the tangent. More...
 
Mesh tessellate (double start, double end, int samples, bool uniform) const
 
double length (double start, double end, double error=0.001) const
 Compute the curve length between the start and end u parameters. More...
 
double param_from_length (double length, double error=0.001, int max_try=100) const
 Compute the parameter for the given arc length. More...
 
double closest (const Imath::V3d &p, Imath::M44d *r=nullptr, double error=0.001, int max_try=10) const
 Compute the curve closest matrix to p. More...
 
- Public Member Functions inherited from maquina::Shape
 Shape ()
 
 Shape (const Value &v)
 Cast a Value object in Shape. More...
 
Imath::Box3f bounding_box () const
 Compute the object bounding box. More...
 
bool has_attribute (const char *attribute_name, Topology topology) const
 Test if the shape has this attribute. More...
 
template<typename T >
write_attribute (const char *attribute_name, Topology topology)
 Get a write access to an attribute. More...
 
const Value read_attribute (const char *attribute_name, Topology topology) const
 Get a read access to an attribute. More...
 
bool set_attribute (const char *name, Topology topology, const Value &value)
 Set an attribute. More...
 
bool remove_attribute (const char *name, Topology topology)
 Remove an attribute. More...
 
void finalize ()
 Finalize the shape after deformation. More...
 
size_t topology_size (Topology topology) const
 Get the number of faces, edges or vertices. More...
 
Attributes read_attributes () const
 Return a read-only attribute iteration. More...
 
- Public Member Functions inherited from maquina::Value
 Value ()
 
Value duplicate () const
 Duplicate the value. More...
 
bool as_bool () const
 Returns the value as a bool. More...
 
int as_int () const
 Returns the value as an integer. More...
 
float as_float () const
 Returns the value as a float. More...
 
double as_double () const
 Returns the value as a double. More...
 
const std::string & as_string () const
 Returns the value as a string. More...
 
std::wstring as_wstring () const
 Returns the value as a wstring. More...
 
Imath::V2f as_V2f () const
 Returns the value as a V2f. More...
 
Imath::V3f as_V3f () const
 Returns the value as a V3f. More...
 
Imath::V4f as_V4f () const
 Returns the value as a V4f. More...
 
const Imath::V2das_V2d () const
 Returns the value as a V2d. More...
 
const Imath::V3das_V3d () const
 Returns the value as a V3d. More...
 
const Imath::V4das_V4d () const
 Returns the value as a V4d. More...
 
const Imath::V2ias_V2i () const
 Returns the value as a V2i. More...
 
const Imath::V3ias_V3i () const
 Returns the value as a V3i. More...
 
const Imath::V4ias_V4i () const
 Returns the value as a V4i. More...
 
Imath::M44f as_M44f () const
 Returns the value as a M44f. More...
 
const Imath::M44das_M44d () const
 Returns the value as a M44d. More...
 
const Imath::Box3fas_Box3f () const
 Returns the value as a Box3f. More...
 
const Imath::Color4fas_Color4f () const
 Returns the value as a Color4f. More...
 
Imath::Quatf as_Quatf () const
 Returns the value as a Quatf. More...
 
const Imath::Quatdas_Quatd () const
 Returns the value as a Quatd. More...
 
std::shared_ptr< const UserDataas_user_data () const
 Returns the value as a user data. More...
 
StringView type_name () const
 Return the type name of the Value. More...
 
bool has_node_delegate () const
 Check if this value can produces a NodeDelegate. More...
 
std::shared_ptr< NodeDelegatenode_delegate (const std::shared_ptr< NodeDelegate > &parent, const StringView &name) const
 
bool operator== (const Value &o) const
 Compare the two values. More...
 
bool operator!= (const Value &o) const
 
bool is_instance (const char *value_type_name) const
 Check if this type derives from another value type. More...
 
bool is_interpolable () const
 Checks if the value is interpolable. More...
 
Value lerp (const Value &other, double weight) const
 Performs linear interpolation between this value and another value. More...
 
 Value (bool)
 Create a boolean value. More...
 
 Value (int)
 Create an integer value. More...
 
 Value (float)
 Create a float value. More...
 
 Value (double)
 Create a double value. More...
 
 Value (const char *string)
 Create a string value. More...
 
 Value (const wchar_t *string)
 Create a string value. More...
 
 Value (const std::string &string)
 Create a string value. More...
 
 Value (const std::wstring &string)
 Create a wide string value. More...
 
 Value (const Imath::V2f &)
 Create a Imath::V2f value. More...
 
 Value (const Imath::V3f &)
 Create a Imath::V3f value. More...
 
 Value (const Imath::V4f &)
 Create a Imath::V4f value. More...
 
 Value (const Imath::V2d &)
 Create a Imath::V2d value. More...
 
 Value (const Imath::V3d &)
 Create a Imath::V3d value. More...
 
 Value (const Imath::V4d &)
 Create a Imath::V4d value. More...
 
 Value (const Imath::V2i &)
 Create a Imath::V2i value. More...
 
 Value (const Imath::V3i &)
 Create a Imath::V3i value. More...
 
 Value (const Imath::V4i &)
 Create a Imath::V4i value. More...
 
 Value (const Imath::Color4f &)
 Create a Imath::Color4f value. More...
 
 Value (const Imath::M44f &)
 Create a Imath::M44f value. More...
 
 Value (const Imath::M44d &)
 Create a Imath::M44d value. More...
 
 Value (const Imath::Box3f &)
 Create a Imath::Box3f value. More...
 
 Value (const Imath::Quatf &)
 Create a Imath::Quatf value. More...
 
 Value (const Imath::Quatd &)
 Create a Imath::Quatd value. More...
 
 Value (const std::shared_ptr< const UserData > &user_data)
 Create a user data value. More...
 

Static Public Attributes

static const MatrixCurve default_value
 The default value. More...
 
- Static Public Attributes inherited from maquina::Value
static const Value default_value
 The default value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from maquina::Value
static bool validate_type_name (const char *type_name)
 Return true if the name is a valid type name. More...
 
static Value get_default_value (const char *type_name)
 Return a default value for a given type. More...
 

Detailed Description

A Matrix curve value.

This object is a special curve built from control matrices, and that outputs a matrix. The position output of the curve is defined by piecewise cubic Splines between the control matrices and along their "main" axis. So are the matrix output's scale and shear, while its rotation is defined using cubic interpolation of the rotations of the control matrices. The tangents of the positional cubic Splines are automatically computed from the control matrices' rotation around the "main" axis.

Member Enumeration Documentation

◆ CurveType

Enumerator
ConstrainedBezier 

The curve is a piecewise cubic Bezier curve, whose internal tangents are driven by the control matrices.

Bezier 

The curve is a piecewise cubic Bezier curve, whose internal tangents are automatic.

Spline 

The curve is a Nurbs curve defined from the control positions.

◆ MainAxis

< Set the control matrix axis used to define the curve

Enumerator

Use the X axis.

Use the Y axis.

Use the Z axis.

MX 

Use the negated X axis.

MY 

Use the negated Y axis.

MZ 

Use the negated Z axis.

◆ OrientationMode

Enumerator
Free 

The orientation along the curve is given by the cubic interpolation of the control matrices.

Constrained 

The orientation along the curve is computed so that the main axis is tangent to the curve.

Constructor & Destructor Documentation

◆ MatrixCurve() [1/3]

maquina::MatrixCurve::MatrixCurve ( )

Create an empty curve.

◆ MatrixCurve() [2/3]

maquina::MatrixCurve::MatrixCurve ( const BufferConstM44d matrices,
CurveType  type,
OrientationMode  mode,
MainAxis  main_axis = MainAxis::X 
)

Create a curve.

◆ MatrixCurve() [3/3]

maquina::MatrixCurve::MatrixCurve ( const Value v)

Cast a Value in NurbsCurve.

If v is not a NurbsCurve object, this object will be an empty curve.

Member Function Documentation

◆ closest()

double maquina::MatrixCurve::closest ( const Imath::V3d p,
Imath::M44d r = nullptr,
double  error = 0.001,
int  max_try = 10 
) const

Compute the curve closest matrix to p.

Returns the curve parameter value of the closest point.

Parameters
pThe position to project on the curve
rIf not null, it is filled with the closest curve matrix
errorThe minimum error in vertex space
max_tryMaximum numbr of try

◆ evaluate()

Imath::M44d maquina::MatrixCurve::evaluate ( double  u) const

Evaluate the curve at a u coordinate, oriented along the tangent.

◆ length()

double maquina::MatrixCurve::length ( double  start,
double  end,
double  error = 0.001 
) const

Compute the curve length between the start and end u parameters.

Parameters
startThe starting u parameter of the arc
endThe ending u parameter of the arc
errorThe relative accepted error of the result

◆ main_axis()

MainAxis maquina::MatrixCurve::main_axis ( ) const

◆ mode()

OrientationMode maquina::MatrixCurve::mode ( ) const

◆ param_from_length()

double maquina::MatrixCurve::param_from_length ( double  length,
double  error = 0.001,
int  max_try = 100 
) const

Compute the parameter for the given arc length.

Parameters
lengthThe arc length for which we want a parameter
errorThe relative accepted error of the result
max_tryMaximum try to reach the error

◆ read_matrices()

const BufferConstM44d maquina::MatrixCurve::read_matrices ( ) const

Return the readable curve matrices.

◆ tessellate()

Mesh maquina::MatrixCurve::tessellate ( double  start,
double  end,
int  samples,
bool  uniform 
) const

Builds the line mesh for the sub-part of the curve delimited by start and end.

Note
If uniform is true, the curve is sampled with uniform arc-length.

◆ type()

CurveType maquina::MatrixCurve::type ( ) const

◆ write_matrices()

BufferM44d maquina::MatrixCurve::write_matrices ( )

Return the writable curve matrices.

Member Data Documentation

◆ default_value

const MatrixCurve maquina::MatrixCurve::default_value
static

The default value.


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