|
Rumba C++ SDK
|
A nurbs surface value. More...
#include <NurbsSurface.h>
Public Types | |
| enum | Mode { Open = 0, Closed = 1, Periodic = 2 } |
| The surface curves mode. More... | |
Public Types inherited from maquina::Shape | |
| enum | Topology { constant =0, vertex, face, face_varying } |
| The different attribute topologies. More... | |
Public Member Functions | |
| NurbsSurface () | |
| Create an empty surface. More... | |
| NurbsSurface (const Value &v) | |
| Cast a Value in NurbsSurface. More... | |
| NurbsSurface (const gsl::span< const NurbsCurve > &curves, int degree_v, Mode mode, bool use_u_direction, bool uniform) | |
| Build a nurbs surface using nurbs curves (loft) More... | |
| NurbsSurface (const gsl::span< const NurbsCurve > &curves, const gsl::span< const float > ¶meters, int degree_v, Mode mode, bool use_u_direction) | |
| Build a nurbs surface using nurbs curves (loft) More... | |
| NurbsSurface (const BufferConstV3f &points, const BufferConstFloat &knots_u, const BufferConstFloat &knots_v, int degree_u, int degree_v, Mode mode_u, Mode mode_v) | |
| Build a surface. More... | |
| const BufferConstFloat | read_knots_u () const |
| Return the readable surface knots in u. More... | |
| BufferFloat | write_knots_u () |
| Return the writable surface knots in u. More... | |
| const BufferConstFloat | read_knots_v () const |
| Return the readable surface knots in v. More... | |
| BufferFloat | write_knots_v () |
| Return the writable surface knots in v. More... | |
| int | control_points_u () const |
| Return the number of control points in u. More... | |
| int | control_points_v () const |
| Return the number of control points in v. More... | |
| int | degree_u () const |
| Return the surface degree in u. More... | |
| int | degree_v () const |
| Return the surface degree in v. More... | |
| Mode | mode_u () const |
| Return the surface degree in u. More... | |
| Mode | mode_v () const |
| Return the surface degree in v. More... | |
| int | span_u () const |
| Return the number of span in u. More... | |
| int | span_v () const |
| Return the number of span in v. More... | |
| Imath::V2f | range_u () const |
| Return the u parameter range. More... | |
| void | set_range_u (const Imath::V2f &r) |
| Set the u parameter range. More... | |
| Imath::V2f | range_v () const |
| Return the v parameter range. More... | |
| void | set_range_v (const Imath::V2f &r) |
| Set the v parameter range. More... | |
| Imath::V3f | control_point (int u, int v) const |
| Return a single control point. More... | |
| Imath::V3f | evaluate (float u, float v) const |
| Evaluate the surface at a uv coordinate. More... | |
| Imath::V3d | evaluate (double u, double v) const |
| Evaluate the surface at a uv coordinate in double precision. More... | |
| Imath::M44d | matrix_at (double u, double v, double n) const |
| Evaluate matrix at a uv coordinate. More... | |
| NurbsCurve | iso_curve (float u, bool use_v) const |
| Extract an iso curve from the surface. More... | |
| std::pair< Imath::V3f, Imath::V3f > | evaluate_dp (float u, float v, bool previous_u=false, bool previous_v=false) const |
| Evaluate the surface position derivatives at a uv coordinate. More... | |
| Imath::V2f | closest (const Imath::V3f &p, Imath::V3f *r=nullptr, float error=0.001f, int max_try=10, const std::shared_ptr< const NurbsSurfaceClosestCache > &cache=nullptr) const |
| Compute the surface closest point to p. More... | |
| std::shared_ptr< const NurbsSurfaceClosestCache > | closest_cache () const |
| Build a cache to speed up closest() queries done on the same nurbs surface. More... | |
| Mesh | tessellate (int subdivision_u, int subdivision_v, bool compute_uv_and_normals=false) const |
| Return a mesh out of the nurbs surface, with the uv and normals if requested. More... | |
| void | remap_knots_u (float new_min, float new_max) |
| Remap the U knots between new_min and float new_max. More... | |
| void | remap_knots_v (float new_min, float new_max) |
| Remap the V knots between new_min and float new_max. More... | |
| void | swap_u_v () |
| Swap the u and v surface parameter. More... | |
| void | refine_knots_u (const gsl::span< const float > &new_knots) |
| Refine the u knots by inserting the new knots. More... | |
| void | refine_knots_v (const gsl::span< const float > &new_knots) |
| Refine the v knots by inserting the new knots. More... | |
Public Member Functions inherited from maquina::Points | |
| Points () | |
| Create an empty. More... | |
| Points (const Value &v) | |
| Cast a Value in Points. More... | |
| BufferV3f | write_points () |
| Return the points buffer. More... | |
| const BufferConstV3f | read_points () const |
| Return the points buffer. More... | |
| size_t | point_count () const |
| Return the number of points. More... | |
| void | compute_vertex_normals (BufferV3f &result) const |
| Compute and return the vertex normals. 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 > | |
| 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::V2d & | as_V2d () const |
| Returns the value as a V2d. More... | |
| const Imath::V3d & | as_V3d () const |
| Returns the value as a V3d. More... | |
| const Imath::V4d & | as_V4d () const |
| Returns the value as a V4d. More... | |
| const Imath::V2i & | as_V2i () const |
| Returns the value as a V2i. More... | |
| const Imath::V3i & | as_V3i () const |
| Returns the value as a V3i. More... | |
| const Imath::V4i & | as_V4i () const |
| Returns the value as a V4i. More... | |
| Imath::M44f | as_M44f () const |
| Returns the value as a M44f. More... | |
| const Imath::M44d & | as_M44d () const |
| Returns the value as a M44d. More... | |
| const Imath::Box3f & | as_Box3f () const |
| Returns the value as a Box3f. More... | |
| const Imath::Color4f & | as_Color4f () const |
| Returns the value as a Color4f. More... | |
| Imath::Quatf | as_Quatf () const |
| Returns the value as a Quatf. More... | |
| const Imath::Quatd & | as_Quatd () const |
| Returns the value as a Quatd. More... | |
| std::shared_ptr< const UserData > | as_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< NodeDelegate > | node_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 Member Functions | |
| static NurbsSurface | fit_open (const gsl::span< const Imath::V3f > &points, const gsl::span< const float > ¶meters_u, const gsl::span< const float > ¶meters_v, const gsl::span< const float > &knots_u, const gsl::span< const float > &knots_v, int pu, int pv, int du, int dv) |
| Fit the surface over a grid of points. More... | |
| static NurbsSurface | fit_close_u (const gsl::span< const Imath::V3f > &points, const gsl::span< const float > ¶meters_u, const gsl::span< const float > ¶meters_v, const gsl::span< const float > &knots_u, const gsl::span< const float > &knots_v, int pu, int pv, int du, int dv) |
| Fit the surface over a grid of points closed in the U direction. 'du' points in the U direction must be wraped (copy of the 'du' first points). More... | |
| static NurbsSurface | fit_close_v (const gsl::span< const Imath::V3f > &points, const gsl::span< const float > ¶meters_u, const gsl::span< const float > ¶meters_v, const gsl::span< const float > &knots_u, const gsl::span< const float > &knots_v, int pu, int pv, int du, int dv) |
| Fit the surface over a grid of points closed in the V direction. 'dv' points in the V direction must be wraped (copy of the 'dv' first points). More... | |
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... | |
Static Public Attributes | |
| static const NurbsSurface | default_value |
| The default value. More... | |
Static Public Attributes inherited from maquina::Points | |
| static const Points | default_value |
| The default value. More... | |
Static Public Attributes inherited from maquina::Value | |
| static const Value | default_value |
| The default value. More... | |
A nurbs surface value.
This object is a standard nurbs surface. The control points are stored in u order first
| maquina::NurbsSurface::NurbsSurface | ( | ) |
Create an empty surface.
| maquina::NurbsSurface::NurbsSurface | ( | const Value & | v | ) |
Cast a Value in NurbsSurface.
If v is not a NurbsSurface object, this object will be an empty nurbs surface.
| maquina::NurbsSurface::NurbsSurface | ( | const gsl::span< const NurbsCurve > & | curves, |
| int | degree_v, | ||
| Mode | mode, | ||
| bool | use_u_direction, | ||
| bool | uniform | ||
| ) |
Build a nurbs surface using nurbs curves (loft)
The curve must have the same degree and the same knots.
| curves | The curves to use to loft the surface |
| degree_v | The degree of the second dimension |
| mode | The mode of the second dimension |
| use_u_direction | If true, loft in the u direction |
| uniform | If true, use an uniform parametrization, if false, use a chord length paramatrization |
| maquina::NurbsSurface::NurbsSurface | ( | const gsl::span< const NurbsCurve > & | curves, |
| const gsl::span< const float > & | parameters, | ||
| int | degree_v, | ||
| Mode | mode, | ||
| bool | use_u_direction | ||
| ) |
Build a nurbs surface using nurbs curves (loft)
The curve must have the same degree and the same knots.
| curves | The curves to use to loft the surface |
| parameters | The parameters of each curve in the final surface. Same size than curves. |
| degree_v | The degree of the second dimension |
| mode | The mode of the second dimension |
| use_u_direction | If true, loft in the u direction |
| maquina::NurbsSurface::NurbsSurface | ( | const BufferConstV3f & | points, |
| const BufferConstFloat & | knots_u, | ||
| const BufferConstFloat & | knots_v, | ||
| int | degree_u, | ||
| int | degree_v, | ||
| Mode | mode_u, | ||
| Mode | mode_v | ||
| ) |
Build a surface.
| Imath::V2f maquina::NurbsSurface::closest | ( | const Imath::V3f & | p, |
| Imath::V3f * | r = nullptr, |
||
| float | error = 0.001f, |
||
| int | max_try = 10, |
||
| const std::shared_ptr< const NurbsSurfaceClosestCache > & | cache = nullptr |
||
| ) | const |
Compute the surface closest point to p.
Returns the surface parameters of the closest point.
| p | The position to project on the surface |
| r | If not null, it is filled with the closest curve position |
| error | Stop to iterate when (du < error*(u_max-umin) && dv < error*(v_max-vmin)) |
| max_try | Maximum number of iterations |
| cache | An optionnal cache |
| std::shared_ptr<const NurbsSurfaceClosestCache> maquina::NurbsSurface::closest_cache | ( | ) | const |
Build a cache to speed up closest() queries done on the same nurbs surface.
The nurbs surface used for the query must be the same than the one used to build the cache.
| Imath::V3f maquina::NurbsSurface::control_point | ( | int | u, |
| int | v | ||
| ) | const |
Return a single control point.
| int maquina::NurbsSurface::control_points_u | ( | ) | const |
Return the number of control points in u.
| int maquina::NurbsSurface::control_points_v | ( | ) | const |
Return the number of control points in v.
| int maquina::NurbsSurface::degree_u | ( | ) | const |
Return the surface degree in u.
| int maquina::NurbsSurface::degree_v | ( | ) | const |
Return the surface degree in v.
| Imath::V3f maquina::NurbsSurface::evaluate | ( | float | u, |
| float | v | ||
| ) | const |
Evaluate the surface at a uv coordinate.
| Imath::V3d maquina::NurbsSurface::evaluate | ( | double | u, |
| double | v | ||
| ) | const |
Evaluate the surface at a uv coordinate in double precision.
| std::pair<Imath::V3f,Imath::V3f> maquina::NurbsSurface::evaluate_dp | ( | float | u, |
| float | v, | ||
| bool | previous_u = false, |
||
| bool | previous_v = false |
||
| ) | const |
Evaluate the surface position derivatives at a uv coordinate.
Return the (dp/du, dp,dv) vectors . They are not normalized.
|
static |
Fit the surface over a grid of points closed in the U direction. 'du' points in the U direction must be wraped (copy of the 'du' first points).
| points | the grid of points, its size must be pu*pv. The (u,v) point is at the index u+v*pu. |
| pu | the number of points in u |
| pv | the number of points in v |
| du | the degree of the curve in u |
| dv | the degree of the curve in v |
|
static |
Fit the surface over a grid of points closed in the V direction. 'dv' points in the V direction must be wraped (copy of the 'dv' first points).
| points | the grid of points, its size must be pu*pv. The (u,v) point is at the index u+v*pu. |
| pu | the number of points in u |
| pv | the number of points in v |
| du | the degree of the curve in u |
| dv | the degree of the curve in v |
|
static |
Fit the surface over a grid of points.
| points | the grid of points, its size must be pu*pv. The (u,v) point is at the index u+v*pu. |
| pu | the number of points in u |
| pv | the number of points in v |
| du | the degree of the curve in u |
| dv | the degree of the curve in v |
| NurbsCurve maquina::NurbsSurface::iso_curve | ( | float | u, |
| bool | use_v | ||
| ) | const |
Extract an iso curve from the surface.
Extract the curve at the u parameter. If use_v is true, extact the curve in the V direction, else in the U direction.
| Imath::M44d maquina::NurbsSurface::matrix_at | ( | double | u, |
| double | v, | ||
| double | n | ||
| ) | const |
Evaluate matrix at a uv coordinate.
| Mode maquina::NurbsSurface::mode_u | ( | ) | const |
Return the surface degree in u.
| Mode maquina::NurbsSurface::mode_v | ( | ) | const |
Return the surface degree in v.
| Imath::V2f maquina::NurbsSurface::range_u | ( | ) | const |
Return the u parameter range.
| Imath::V2f maquina::NurbsSurface::range_v | ( | ) | const |
Return the v parameter range.
| const BufferConstFloat maquina::NurbsSurface::read_knots_u | ( | ) | const |
Return the readable surface knots in u.
| const BufferConstFloat maquina::NurbsSurface::read_knots_v | ( | ) | const |
Return the readable surface knots in v.
| void maquina::NurbsSurface::refine_knots_u | ( | const gsl::span< const float > & | new_knots | ) |
Refine the u knots by inserting the new knots.
| void maquina::NurbsSurface::refine_knots_v | ( | const gsl::span< const float > & | new_knots | ) |
Refine the v knots by inserting the new knots.
| void maquina::NurbsSurface::remap_knots_u | ( | float | new_min, |
| float | new_max | ||
| ) |
Remap the U knots between new_min and float new_max.
| void maquina::NurbsSurface::remap_knots_v | ( | float | new_min, |
| float | new_max | ||
| ) |
Remap the V knots between new_min and float new_max.
| void maquina::NurbsSurface::set_range_u | ( | const Imath::V2f & | r | ) |
Set the u parameter range.
| void maquina::NurbsSurface::set_range_v | ( | const Imath::V2f & | r | ) |
Set the v parameter range.
| int maquina::NurbsSurface::span_u | ( | ) | const |
Return the number of span in u.
| int maquina::NurbsSurface::span_v | ( | ) | const |
Return the number of span in v.
| void maquina::NurbsSurface::swap_u_v | ( | ) |
Swap the u and v surface parameter.
| Mesh maquina::NurbsSurface::tessellate | ( | int | subdivision_u, |
| int | subdivision_v, | ||
| bool | compute_uv_and_normals = false |
||
| ) | const |
Return a mesh out of the nurbs surface, with the uv and normals if requested.
| BufferFloat maquina::NurbsSurface::write_knots_u | ( | ) |
Return the writable surface knots in u.
| BufferFloat maquina::NurbsSurface::write_knots_v | ( | ) |
Return the writable surface knots in v.
|
static |
The default value.