Blender V4.3
Freestyle::Stroke Class Reference

#include <Stroke.h>

Inherits Freestyle::Interface1D.

Public Types

enum  MediumType { DRY_MEDIUM , HUMID_MEDIUM , OPAQUE_MEDIUM }
 
typedef std::deque< StrokeVertex * > vertex_container
 
typedef std::vector< ViewEdge * > viewedge_container
 
typedef StrokeInternal::vertex_iterator_base< StrokeInternal::vertex_nonconst_traitsvertex_iterator
 
typedef StrokeInternal::vertex_iterator_base< StrokeInternal::vertex_const_traitsconst_vertex_iterator
 

Public Member Functions

virtual string getExactTypeName () const
 
virtual Id getId () const
 
 Stroke ()
 
 Stroke (const Stroke &iBrother)
 
template<class InputVertexIterator >
 Stroke (InputVertexIterator iBegin, InputVertexIterator iEnd)
 
virtual ~Stroke ()
 
Strokeoperator= (const Stroke &iBrother)
 
float ComputeSampling (int iNVertices)
 
int Resample (int iNPoints)
 
int Resample (float iSampling)
 
void RemoveAllVertices ()
 
void RemoveVertex (StrokeVertex *iVertex)
 
void InsertVertex (StrokeVertex *iVertex, StrokeInternal::StrokeVertexIterator next)
 
void UpdateLength ()
 
void ScaleThickness (float iFactor)
 
void Render (const StrokeRenderer *iRenderer)
 
void RenderBasic (const StrokeRenderer *iRenderer)
 
real getLength2D () const
 
MediumType getMediumType () const
 
uint getTextureId ()
 
float getTextureStep ()
 
MTexgetMTex (int idx)
 
bNodeTreegetNodeTree ()
 
bool hasTex () const
 
bool hasTips () const
 
int vertices_size () const
 
viewedge_container::const_iterator viewedges_begin () const
 
viewedge_container::iterator viewedges_begin ()
 
viewedge_container::const_iterator viewedges_end () const
 
viewedge_container::iterator viewedges_end ()
 
int viewedges_size () const
 
Vec2r getBeginningOrientation () const
 
real getBeginningOrientationX () const
 
real getBeginningOrientationY () const
 
Vec2r getEndingOrientation () const
 
real getEndingOrientationX () const
 
real getEndingOrientationY () const
 
void setId (const Id &id)
 
void setLength (float iLength)
 
void setMediumType (MediumType iType)
 
void setTextureId (uint id)
 
void setTextureStep (float step)
 
int setMTex (MTex *mtex)
 
void setNodeTree (bNodeTree *iNodeTree)
 
void setTips (bool iTips)
 
void push_back (StrokeVertex *iVertex)
 
void push_front (StrokeVertex *iVertex)
 
void AddViewEdge (ViewEdge *iViewEdge)
 
void setBeginningOrientation (const Vec2r &iOrientation)
 
void setBeginningOrientation (real x, real y)
 
void setEndingOrientation (const Vec2r &iOrientation)
 
void setEndingOrientation (real x, real y)
 
const_vertex_iterator vertices_begin () const
 embedding vertex iterator
 
vertex_iterator vertices_begin (float sampling=0.0f)
 
const_vertex_iterator vertices_end () const
 
vertex_iterator vertices_end ()
 
StrokeInternal::StrokeVertexIterator strokeVerticesBegin (float t=0.0f)
 
StrokeInternal::StrokeVertexIterator strokeVerticesEnd ()
 
uint strokeVerticesSize () const
 
StrokeVertexstrokeVerticeAt (uint i)
 
virtual Interface0DIterator verticesBegin ()
 
virtual Interface0DIterator verticesEnd ()
 
virtual Interface0DIterator pointsBegin (float t=0.0f)
 
virtual Interface0DIterator pointsEnd (float t=0.0f)
 
- Public Member Functions inherited from Freestyle::Interface1D
 Interface1D ()
 
virtual ~Interface1D ()
 
virtual Nature::EdgeNature getNature () const
 
virtual uint getTimeStamp () const
 
void setTimeStamp (uint iTimeStamp)
 

Additional Inherited Members

- Protected Attributes inherited from Freestyle::Interface1D
uint _timeStamp
 

Detailed Description

Class to define a stroke. A stroke is made of a set of 2D vertices (StrokeVertex), regularly spaced out. This set of vertices defines the stroke's backbone geometry. Each of these stroke vertices defines the stroke's shape and appearance at this vertex position.

Definition at line 489 of file Stroke.h.

Member Typedef Documentation

◆ const_vertex_iterator

◆ vertex_container

Definition at line 513 of file Stroke.h.

◆ vertex_iterator

◆ viewedge_container

Definition at line 514 of file Stroke.h.

Member Enumeration Documentation

◆ MediumType

The different blending modes available to simulate the interaction media-medium.

Enumerator
DRY_MEDIUM 

To simulate a dry medium such as Pencil or Charcoal.

HUMID_MEDIUM 

To simulate ink painting (color subtraction blending).

OPAQUE_MEDIUM 

To simulate an opaque medium (oil, spray...).

Definition at line 506 of file Stroke.h.

Constructor & Destructor Documentation

◆ Stroke() [1/3]

Freestyle::Stroke::Stroke ( )

default constructor

Definition at line 393 of file Stroke.cpp.

References Freestyle::a, FLT_MAX, MAX_MTEX, and OPAQUE_MEDIUM.

◆ Stroke() [2/3]

Freestyle::Stroke::Stroke ( const Stroke & iBrother)

copy constructor

Definition at line 410 of file Stroke.cpp.

References Freestyle::a, MAX_MTEX, and v.

◆ Stroke() [3/3]

template<class InputVertexIterator >
Freestyle::Stroke::Stroke ( InputVertexIterator iBegin,
InputVertexIterator iEnd )

Builds a stroke from a set of StrokeVertex. This constructor is templated by an iterator type. This iterator type must allow the vertices parsing using the ++ operator.

Parameters
iBeginThe iterator pointing to the first vertex.
iEndThe iterator pointing to the end of the vertex list.

Definition at line 871 of file Stroke.h.

References v.

◆ ~Stroke()

Freestyle::Stroke::~Stroke ( )
virtual

Destructor

Definition at line 439 of file Stroke.cpp.

References v.

Member Function Documentation

◆ AddViewEdge()

void Freestyle::Stroke::AddViewEdge ( ViewEdge * iViewEdge)
inline

Definition at line 794 of file Stroke.h.

◆ ComputeSampling()

float Freestyle::Stroke::ComputeSampling ( int iNVertices)

Compute the sampling needed to get iNVertices vertices. If the specified number of vertices is less than the actual number of vertices, the actual sampling value is returned. (To remove Vertices, use the RemoveVertex() method of this class).

Parameters
iNVerticesThe number of StrokeVertices we eventually want in our Stroke.
Returns
the sampling that must be used in the Resample(float) method.
See also
Resample(int)
Resample(float)

Definition at line 491 of file Stroke.cpp.

References float.

Referenced by Freestyle::StrokeShaders::BezierCurveShader::shade().

◆ getBeginningOrientation()

Vec2r Freestyle::Stroke::getBeginningOrientation ( ) const
inline

Definition at line 702 of file Stroke.h.

◆ getBeginningOrientationX()

real Freestyle::Stroke::getBeginningOrientationX ( ) const
inline

Definition at line 707 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::x().

◆ getBeginningOrientationY()

real Freestyle::Stroke::getBeginningOrientationY ( ) const
inline

Definition at line 712 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::y().

◆ getEndingOrientation()

Vec2r Freestyle::Stroke::getEndingOrientation ( ) const
inline

Definition at line 717 of file Stroke.h.

◆ getEndingOrientationX()

real Freestyle::Stroke::getEndingOrientationX ( ) const
inline

Definition at line 722 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::x().

◆ getEndingOrientationY()

real Freestyle::Stroke::getEndingOrientationY ( ) const
inline

Definition at line 727 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::y().

◆ getExactTypeName()

virtual string Freestyle::Stroke::getExactTypeName ( ) const
inlinevirtual

Returns the string "Stroke"

Reimplemented from Freestyle::Interface1D.

Definition at line 492 of file Stroke.h.

◆ getId()

virtual Id Freestyle::Stroke::getId ( ) const
inlinevirtual

◆ getLength2D()

◆ getMediumType()

MediumType Freestyle::Stroke::getMediumType ( ) const
inline

Returns a reference to the time stamp value of the stroke. Returns the MediumType used for this Stroke.

Definition at line 630 of file Stroke.h.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeRep::StrokeRep().

◆ getMTex()

MTex * Freestyle::Stroke::getMTex ( int idx)
inline

Returns the texture used at given index to simulate the marks system for this Stroke

Definition at line 648 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getNodeTree()

bNodeTree * Freestyle::Stroke::getNodeTree ( )
inline

Return the shader node tree to define textures.

Definition at line 654 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getTextureId()

uint Freestyle::Stroke::getTextureId ( )
inline

Returns the id of the texture used to simulate th marks system for this Stroke

Definition at line 636 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getTextureStep()

float Freestyle::Stroke::getTextureStep ( )
inline

Returns the spacing of texture coordinates along the stroke length

Definition at line 642 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ hasTex()

bool Freestyle::Stroke::hasTex ( ) const
inline

Returns true if this Stroke has textures assigned, false otherwise.

Definition at line 660 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ hasTips()

bool Freestyle::Stroke::hasTips ( ) const
inline

Returns true if this Stroke uses a texture with tips, false otherwise.

Definition at line 666 of file Stroke.h.

◆ InsertVertex()

void Freestyle::Stroke::InsertVertex ( StrokeVertex * iVertex,
StrokeInternal::StrokeVertexIterator next )

Inserts the stroke vertex iVertex in the stroke before next. The length, curvilinear abscissa are updated consequently.

Parameters
iVertexThe StrokeVertex to insert in the Stroke.
nextA StrokeVertexIterator pointing to the StrokeVertex before which iVertex must be inserted.

Definition at line 716 of file Stroke.cpp.

References next, and UpdateLength().

◆ operator=()

Stroke & Freestyle::Stroke::operator= ( const Stroke & iBrother)

operator =

Definition at line 456 of file Stroke.cpp.

References v.

◆ pointsBegin()

Interface0DIterator Freestyle::Stroke::pointsBegin ( float t = 0.0f)
virtual

Returns an iterator over the Interface1D points, pointing to the first point. The difference with verticesBegin() is that here we can iterate over points of the 1D element at a any given sampling. Indeed, for each iteration, a virtual point is created.

Parameters
tThe sampling with which we want to iterate over points of this 1D element.

Reimplemented from Freestyle::Interface1D.

Definition at line 785 of file Stroke.cpp.

References verticesBegin().

◆ pointsEnd()

Interface0DIterator Freestyle::Stroke::pointsEnd ( float t = 0.0f)
virtual

Returns an iterator over the Interface1D points, pointing after the last point. The difference with verticesEnd() is that here we can iterate over points of the 1D element at a any given sampling. Indeed, for each iteration, a virtual point is created.

Parameters
tThe sampling with which we want to iterate over points of this 1D element.

Reimplemented from Freestyle::Interface1D.

Definition at line 790 of file Stroke.cpp.

References verticesEnd().

◆ push_back()

void Freestyle::Stroke::push_back ( StrokeVertex * iVertex)
inline

Definition at line 784 of file Stroke.h.

Referenced by Freestyle::createStroke().

◆ push_front()

void Freestyle::Stroke::push_front ( StrokeVertex * iVertex)
inline

Definition at line 789 of file Stroke.h.

◆ RemoveAllVertices()

void Freestyle::Stroke::RemoveAllVertices ( )

Removes all vertices from the Stroke.

Definition at line 693 of file Stroke.cpp.

References UpdateLength().

◆ RemoveVertex()

void Freestyle::Stroke::RemoveVertex ( StrokeVertex * iVertex)

Removes the stroke vertex iVertex from the stroke. The length and curvilinear abscissa are updated consequently.

Definition at line 703 of file Stroke.cpp.

References UpdateLength().

Referenced by Freestyle::StrokeShaders::BezierCurveShader::shade(), and Freestyle::StrokeShaders::TipRemoverShader::shade().

◆ Render()

void Freestyle::Stroke::Render ( const StrokeRenderer * iRenderer)

◆ RenderBasic()

void Freestyle::Stroke::RenderBasic ( const StrokeRenderer * iRenderer)

◆ Resample() [1/2]

int Freestyle::Stroke::Resample ( float iSampling)

Resampling method. Resamples the curve with a given sampling. If this sampling is < to the actual sampling value, no resampling is done.

Parameters
iSamplingThe new sampling value.

Definition at line 636 of file Stroke.cpp.

References Freestyle::a, b, next, Freestyle::VecMat::Vec< T, N >::norm(), strokeVerticesBegin(), and strokeVerticesEnd().

◆ Resample() [2/2]

int Freestyle::Stroke::Resample ( int iNPoints)

Resampling method. Resamples the curve so that it eventually has iNPoints. That means it is going to add iNPoints-vertices_size, if vertices_size is the number of points we already have. If vertices_size >= iNPoints, no resampling is done.

Parameters
iNPointsThe number of vertices we eventually want in our stroke.

Definition at line 525 of file Stroke.cpp.

References Freestyle::a, b, float, floor(), int, N, next, Freestyle::VecMat::Vec< T, N >::norm(), strokeVerticesBegin(), strokeVerticesEnd(), and strokeVerticesSize().

Referenced by Freestyle::StrokeShaders::BezierCurveShader::shade(), Freestyle::StrokeShaders::SamplingShader::shade(), Freestyle::StrokeShaders::TipRemoverShader::shade(), strokeVerticesBegin(), and vertices_begin().

◆ ScaleThickness()

void Freestyle::Stroke::ScaleThickness ( float iFactor)

◆ setBeginningOrientation() [1/2]

void Freestyle::Stroke::setBeginningOrientation ( const Vec2r & iOrientation)
inline

Definition at line 799 of file Stroke.h.

◆ setBeginningOrientation() [2/2]

void Freestyle::Stroke::setBeginningOrientation ( real x,
real y )
inline

Definition at line 804 of file Stroke.h.

◆ setEndingOrientation() [1/2]

void Freestyle::Stroke::setEndingOrientation ( const Vec2r & iOrientation)
inline

Definition at line 809 of file Stroke.h.

◆ setEndingOrientation() [2/2]

void Freestyle::Stroke::setEndingOrientation ( real x,
real y )
inline

Definition at line 814 of file Stroke.h.

◆ setId()

void Freestyle::Stroke::setId ( const Id & id)
inline

sets the Id of the Stroke.

Definition at line 734 of file Stroke.h.

Referenced by Freestyle::createStroke().

◆ setLength()

void Freestyle::Stroke::setLength ( float iLength)

sets the 2D length of the Stroke.

Definition at line 483 of file Stroke.cpp.

References v.

Referenced by Freestyle::createStroke().

◆ setMediumType()

void Freestyle::Stroke::setMediumType ( MediumType iType)
inline

sets the medium type that must be used for this Stroke.

Definition at line 743 of file Stroke.h.

◆ setMTex()

int Freestyle::Stroke::setMTex ( MTex * mtex)
inline

assigns a blender texture to the first available slot.

Definition at line 761 of file Stroke.h.

References Freestyle::a, and MAX_MTEX.

Referenced by Freestyle::StrokeShaders::BlenderTextureShader::shade().

◆ setNodeTree()

void Freestyle::Stroke::setNodeTree ( bNodeTree * iNodeTree)
inline

assigns a node tree (of new shading nodes) to define textures.

Definition at line 773 of file Stroke.h.

Referenced by Freestyle::StrokeShaders::BlenderTextureShader::shade().

◆ setTextureId()

void Freestyle::Stroke::setTextureId ( uint id)
inline

sets the texture id to be used to simulate the marks system for this Stroke.

Definition at line 749 of file Stroke.h.

◆ setTextureStep()

void Freestyle::Stroke::setTextureStep ( float step)
inline

sets the spacing of texture coordinates along the stroke length.

Definition at line 755 of file Stroke.h.

Referenced by Freestyle::StrokeShaders::StrokeTextureStepShader::shade().

◆ setTips()

void Freestyle::Stroke::setTips ( bool iTips)
inline

sets the flag telling whether this stroke is using a texture with tips or not.

Definition at line 779 of file Stroke.h.

◆ strokeVerticeAt()

StrokeVertex & Freestyle::Stroke::strokeVerticeAt ( uint i)
inline

Returns the i-th StrokeVertex constituting the Stroke.

Definition at line 845 of file Stroke.h.

◆ strokeVerticesBegin()

StrokeInternal::StrokeVertexIterator Freestyle::Stroke::strokeVerticesBegin ( float t = 0.0f)

◆ strokeVerticesEnd()

◆ strokeVerticesSize()

◆ UpdateLength()

◆ vertices_begin() [1/2]

Stroke::const_vertex_iterator Freestyle::Stroke::vertices_begin ( ) const

embedding vertex iterator

Definition at line 741 of file Stroke.cpp.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeTesselator::Tesselate().

◆ vertices_begin() [2/2]

Stroke::vertex_iterator Freestyle::Stroke::vertices_begin ( float sampling = 0.0f)

Definition at line 821 of file Stroke.cpp.

References Resample().

◆ vertices_end() [1/2]

Stroke::vertex_iterator Freestyle::Stroke::vertices_end ( )

Definition at line 751 of file Stroke.cpp.

◆ vertices_end() [2/2]

Stroke::const_vertex_iterator Freestyle::Stroke::vertices_end ( ) const

Definition at line 746 of file Stroke.cpp.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeTesselator::Tesselate().

◆ vertices_size()

int Freestyle::Stroke::vertices_size ( ) const
inline

◆ verticesBegin()

◆ verticesEnd()

Interface0DIterator Freestyle::Stroke::verticesEnd ( )
virtual

Returns an Interface0DIterator pointing after the last StrokeVertex of the Stroke.

Reimplemented from Freestyle::Interface1D.

Definition at line 778 of file Stroke.cpp.

References ret.

Referenced by pointsEnd(), and Freestyle::StrokeShaders::MaterialColorShader::shade().

◆ viewedges_begin() [1/2]

viewedge_container::iterator Freestyle::Stroke::viewedges_begin ( )
inline

Definition at line 682 of file Stroke.h.

◆ viewedges_begin() [2/2]

viewedge_container::const_iterator Freestyle::Stroke::viewedges_begin ( ) const
inline

Definition at line 677 of file Stroke.h.

◆ viewedges_end() [1/2]

viewedge_container::iterator Freestyle::Stroke::viewedges_end ( )
inline

Definition at line 692 of file Stroke.h.

◆ viewedges_end() [2/2]

viewedge_container::const_iterator Freestyle::Stroke::viewedges_end ( ) const
inline

Definition at line 687 of file Stroke.h.

◆ viewedges_size()

int Freestyle::Stroke::viewedges_size ( ) const
inline

Definition at line 697 of file Stroke.h.


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