3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
coat::Curve Class Reference
Inheritance diagram for coat::Curve:
coat::SceneElement

Public Member Functions

 Curve ()
 the default constructor, creates the curve without insertion into the scene, it is good for the temporary curves.
 
 Curve (OneCurveObject *ob)
 create Curve based on low-level object OneCurveObject
 
 Curve (SceneElement &el)
 create the curve object based on the SceneElement, it is valid only is scene element is curve
 
Curveoperator= (SceneElement &el)
 
int pointsCount ()
 get the base points cout in the curve
 
OneSelPoint * point (int idx)
 get the base point pointer
 
void removePoints (int index, int count)
 remove the points out of the curve base points list
 
OneCurveObject * curve ()
 get the low-level ObjeCurveObject pointer
 
int renderPointsCount ()
 returns the visual points count. Visual points used to render the curve in the viewport as set of straight lines.
 
OneSelPoint * renderPoint (int idx)
 returns the visual point reference
 
void updatePoints ()
 update the visual points if need. Use this function if you cahnge the curve. Change the multiple parameters and then call this function if you need visual points. Othervice they will be updated automatically later.
 
bool & closed ()
 returns the reference to the closed state of the curve to get or set the value
 
void add (const Vector3D &p, const Vector3D &normal, float Radius)
 add the point to the curve without the direct options the tangents
 
void addSharp (const Vector3D &p, const Vector3D &normal, float Radius)
 add the sharp point to the curve
 
void addSmooth (const Vector3D &p, const Vector3D &normal, float Radius)
 add the smooth B-spline-like point to the curve
 
void addBothTangents (const Vector3D &p, const Vector3D &normal, const Vector3D &inTangent, const Vector3D &outTangent, float Radius)
 add the point with two independent tangents.
 
void addWithTangent (const Vector3D &p, const Vector3D &normal, const Vector3D &inOutTangent, float Radius)
 add the point with the opposite tangents
 
void tubeToMesh (Mesh &mesh, bool hemisphere)
 create the solid tube around the curve using the points radius
 
std::tuple< vec3, vec3, vec3, vec3, float > getPoint (int idx)
 get the point of the curve
 
void setPointPosition (int idx, const vec3 &p)
 set the point position
 
void setPointNormal (int idx, const vec3 &n)
 set the point normal
 
void setPointTangents (int idx, const vec3 &t1, const vec3 &t2)
 set the point tangents
 
void setPointRadius (int idx, float r)
 set the point radius
 
bool isOpen ()
 check if the curve is open
 
void setOpen ()
 set the curve to be open
 
void setClosed ()
 set the curve to be closed
 
void unselectPoints ()
 unselect all curve points
 
void selectPoint (int idx)
 select the curve point
 
void fill (Mesh &mesh, float thickness, float relax_count=0, float details_level=1, float extrusion=0)
 Create the curved surface around the curve.
 
- Public Member Functions inherited from coat::SceneElement
 SceneElement (VolumeObject *vo)
 
 SceneElement (ItemsTree *c)
 
 SceneElement (const SceneElement &other)
 
const bool operator== (const SceneElement &other) const
 
const bool operator!= (const SceneElement &other) const
 
SceneElement parent () const
 get the parent scene graph element
 
int childCount () const
 returns the child elements count
 
SceneElement child (int index) const
 returns child element by index
 
bool isSculptObject () const
 Check if it is the sculpt object.
 
bool isCurve () const
 Check if the element is curve.
 
const SceneElementsetTransform (const mat4 &Transform) const
 Set the transform matrix.
 
const SceneElementtransform (const mat4 &Transform) const
 Additional transform over the object.
 
const SceneElementdensity (float density_value) const
 this command useful if you use voxels, it sets the scale for the volume so that there will be density_value of voxels per mm
 
const SceneElementtransform_single (const mat4 &Transform) const
 Additional transform over the object, not applied to child objects.
 
mat4 getTransform () const
 get the scene element transform
 
const SceneElementclear () const
 Clear the element content.
 
const char * name () const
 get the element name
 
const char * getLinkedPath (int id) const
 get the linked file path
 
int linkedObjectCount () const
 get the linked file path
 
void addLinkedPath (const char *path) const
 set the linked file path
 
const SceneElementrename (const char *name) const
 rename the element
 
SceneElement addChild (const char *name) const
 add the child element of the same nature
 
SceneElement findInSubtree (const char *name) const
 find the element in subtree by name
 
bool iterateSubtree (const std::function< bool(SceneElement)> &fn) const
 iterate over the subtree
 
bool iterateSubtree (const pybind11::object &fn) const
 iterate over the subtree
 
bool iterateVisibleSubtree (const std::function< bool(SceneElement)> &fn) const
 iterate over the visible subtree
 
bool iterateVisibleSubtree (const pybind11::object &fn) const
 iterate over the visible subtree
 
void mergeSubtree (bool booleanMerge=false) const
 merge all subtree volumes into this
 
void mergeTo (const SceneElement &dest, BoolOpType op)
 merge the volume to another one, delete this volume
 
void copyMergeTo (SceneElement &dest, BoolOpType op)
 copy and merge the volume to another one, delete this volume
 
void removeSubtree () const
 remove the whole subtree
 
void removeSubtreeItem (int index) const
 remove one child from the subtree
 
void remove () const
 remove this item and all child objects from the scene
 
SceneElement duplicate () const
 diplicate the item
 
SceneElement duplicateAsInstance () const
 create the instance of the object if instancing supported
 
void changeParent (SceneElement newParent) const
 change the parent element for the current one
 
void moveTo (SceneElement newParent, int indexInParent) const
 move the element to another parent
 
bool isParentOf (SceneElement child) const
 check if the element is parent of another one
 
bool & visible () const
 returns own visibility state reference. It does not take into account that parent may be invisible.
 
void setVisibility (bool visible) const
 set the visibility of the element
 
bool ghost () const
 returs the state of ghosting (if available)
 
void setGhost (bool ghost) const
 sets the ghosting state (if available)
 
vec4 getReferenceColor ()
 get the reference color for the element
 
void setReferenceColor (const vec4 &color)
 set the reference color for the element
 
Volume Volume () const
 returns the volume object to operate over voxels or surface
 
void select () const
 add the object to selected
 
void selectOne () const
 unselect all similar elements and select this one
 
void unselectAll () const
 unselect all similar objects
 
bool selected ()
 Check if the scene element is selected.
 
void collectSelected (list< SceneElement > &elemList)
 Collect the selected elements in the subtree (including this element if selected)
 
std::vector< SceneElementcollectSelected ()
 Collect the selected elements in the subtree (including this element if selected)
 

Friends

class SceneElement
 

Additional Inherited Members

- Protected Member Functions inherited from coat::SceneElement
VoxTreeBranch * tb () const
 
OneCurveObject * cu () const
 
- Protected Attributes inherited from coat::SceneElement
ItemsTree * el
 

Detailed Description

Constructor & Destructor Documentation

◆ Curve() [1/2]

coat::Curve::Curve ( OneCurveObject * ob)

create Curve based on low-level object OneCurveObject

Parameters
obthe OneCurveObject pointer

◆ Curve() [2/2]

coat::Curve::Curve ( SceneElement & el)

create the curve object based on the SceneElement, it is valid only is scene element is curve

Parameters
elthe scene element

Member Function Documentation

◆ add()

void coat::Curve::add ( const Vector3D & p,
const Vector3D & normal,
float Radius )

add the point to the curve without the direct options the tangents

Parameters
pthe point in space
normalthe normal to the point
Radiusthe point radius
Examples
TreesGenerator.cpp.

◆ addBothTangents()

void coat::Curve::addBothTangents ( const Vector3D & p,
const Vector3D & normal,
const Vector3D & inTangent,
const Vector3D & outTangent,
float Radius )

add the point with two independent tangents.

Parameters
pthe position
normalthe normal
inTangentinput tangent, it is usually approximately directed from the current to the previous point
outTangentoutput tangent, it is usually approximately directed from the current to the next point
Radiusthe radius

◆ addSharp()

void coat::Curve::addSharp ( const Vector3D & p,
const Vector3D & normal,
float Radius )

add the sharp point to the curve

Parameters
pthe point in space
normalthe normal to the point
Radiusthe point radius

◆ addSmooth()

void coat::Curve::addSmooth ( const Vector3D & p,
const Vector3D & normal,
float Radius )

add the smooth B-spline-like point to the curve

Parameters
pthe position
normalthe normal
Radiusthe radius

◆ addWithTangent()

void coat::Curve::addWithTangent ( const Vector3D & p,
const Vector3D & normal,
const Vector3D & inOutTangent,
float Radius )

add the point with the opposite tangents

Parameters
pthe position
normalthe normal
inOutTangentthe tangent, it is usually approximately directed from the current to the next point
Radiusthe radius

◆ closed()

bool & coat::Curve::closed ( )

returns the reference to the closed state of the curve to get or set the value

Returns
the reference

◆ curve()

OneCurveObject * coat::Curve::curve ( )

get the low-level ObjeCurveObject pointer

Returns
the OneCurveObject pointer

◆ fill()

void coat::Curve::fill ( Mesh & mesh,
float thickness,
float relax_count = 0,
float details_level = 1,
float extrusion = 0 )

Create the curved surface around the curve.

Parameters
meshthe resulting mesh
thicknessthe thickness of the object
relax_countthe relaxation degree
details_levelthe details levels
extrusionthe additional extrusion

◆ getPoint()

std::tuple< vec3, vec3, vec3, vec3, float > coat::Curve::getPoint ( int idx)

get the point of the curve

Parameters
idxthe point index
Returns
the point as tuple (position, normal, tangent1, tangent2, radius)

◆ point()

OneSelPoint * coat::Curve::point ( int idx)

get the base point pointer

Parameters
idxthe index in the points array
Returns
the pointer to the point if it is in range, nullptr othervice
Examples
TreesGenerator.cpp.

◆ pointsCount()

int coat::Curve::pointsCount ( )

get the base points cout in the curve

Returns
the points count
Examples
TreesGenerator.cpp.

◆ removePoints()

void coat::Curve::removePoints ( int index,
int count )

remove the points out of the curve base points list

Parameters
indexthe start point index
countpoints count to remove

◆ renderPoint()

OneSelPoint * coat::Curve::renderPoint ( int idx)

returns the visual point reference

Parameters
idxthe point index
Returns
the pointer to the point if it is in range, nullptr othervice
Examples
TreesGenerator.cpp.

◆ renderPointsCount()

int coat::Curve::renderPointsCount ( )

returns the visual points count. Visual points used to render the curve in the viewport as set of straight lines.

Returns
the count
Examples
TreesGenerator.cpp.

◆ selectPoint()

void coat::Curve::selectPoint ( int idx)

select the curve point

Parameters
idxthe point index

◆ setPointNormal()

void coat::Curve::setPointNormal ( int idx,
const vec3 & n )

set the point normal

Parameters
idxthe point index
nthe normal

◆ setPointPosition()

void coat::Curve::setPointPosition ( int idx,
const vec3 & p )

set the point position

Parameters
idxthe point index
pthe position

◆ setPointRadius()

void coat::Curve::setPointRadius ( int idx,
float r )

set the point radius

Parameters
idxthe point index
rthe radius

◆ setPointTangents()

void coat::Curve::setPointTangents ( int idx,
const vec3 & t1,
const vec3 & t2 )

set the point tangents

Parameters
idxthe point index
t1the first tangent
t2the second tangent

◆ tubeToMesh()

void coat::Curve::tubeToMesh ( Mesh & mesh,
bool hemisphere )

create the solid tube around the curve using the points radius

Parameters
meshthis mesh will be created as the result of the operation
hemisphereset true if need the ends of the rode to be hemispheres
Examples
TreesGenerator.cpp.

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