Freestyle Data Types & Operators (freestyle)

This module provides classes for defining line drawing rules (such as predicates, functions, chaining iterators, and stroke shaders), as well as helper functions for style module writing.

Class hierarchy:

freestyle.blendRamp(type, color1, fac, color2)

Blend two colors according to a ramp blend type.

Parameters:
  • type (int) – Ramp blend type.
  • color1 (mathutils.Vector, list or tuple of 3 real numbers) – 1st color.
  • fac (float) – Blend factor.
  • color2 (mathutils.Vector, list or tuple of 3 real numbers) – 1st color.
Returns:

Blended color in RGB format.

Return type:

mathutils.Vector

freestyle.evaluateColorRamp(ramp, in)

Evaluate a color ramp at a point in the interval 0 to 1.

Parameters:
  • ramp (bpy.types.ColorRamp) – Color ramp object.
  • in (float) – Value in the interval 0 to 1.
Returns:

color in RGBA format.

Return type:

mathutils.Vector

freestyle.evaluateCurveMappingF(cumap, cur, value)

Evaluate a curve mapping at a point in the interval 0 to 1.

Parameters:
  • cumap (bpy.types.CurveMapping) – Curve mapping object.
  • cur (int) – Index of the curve to be used (0 <= cur <= 3).
  • value (float) – Input value in the interval 0 to 1.
Returns:

Mapped output value.

Return type:

float

freestyle.getCurrentScene()

Returns the current scene.

Returns:The current scene.
Return type:bpy.types.Scene
freestyle.integrate(func, it, it_end, integration_type)

Returns a single value from a set of values evaluated at each 0D element of this 1D element.

Parameters:
  • func (UnaryFunction0D) – The UnaryFunction0D used to compute a value at each Interface0D.
  • it (Interface0DIterator) – The Interface0DIterator used to iterate over the 0D elements of this 1D element. The integration will occur over the 0D elements starting from the one pointed by it.
  • it_end (Interface0DIterator) – The Interface0DIterator pointing the end of the 0D elements of the 1D element.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
Returns:

The single value obtained for the 1D element. The return value type is float if func is of the UnaryFunction0DDouble or UnaryFunction0DFloat type, and int if func is of the UnaryFunction0DUnsigned type.

Return type:

int or float

class freestyle.AdjacencyIterator

Class hierarchy: Iterator > AdjacencyIterator

Class for representing adjacency iterators used in the chaining process. An AdjacencyIterator is created in the increment() and decrement() methods of a ChainingIterator and passed to the traverse() method of the ChainingIterator.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (AdjacencyIterator) – An AdjacencyIterator object.
__init__(vertex, restrict_to_selection=True, restrict_to_unvisited=True)

Builds a AdjacencyIterator object.

Parameters:
  • vertex (ViewVertex) – The vertex which is the next crossing.
  • restrict_to_selection (bool) – Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
  • restrict_to_unvisited (bool) – Indicates whether a ViewEdge that has already been chained must be ignored ot not.
is_incoming

True if the current ViewEdge is coming towards the iteration vertex, and False otherwise.

Type :bool
object

The ViewEdge object currently pointed by this iterator.

Type :ViewEdge
class freestyle.BBox

Class for representing a bounding box.

__init__()

Default constructor.

class freestyle.BackboneStretcherShader

Class hierarchy: StrokeShader > BackboneStretcherShader

[Geometry shader]

__init__(amount=2.0)

Builds a BackboneStretcherShader object.

Parameters:amount (float) – The stretching amount value.
shade(stroke)

Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) and v(n-1)v(n).

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.BezierCurveShader

Class hierarchy: StrokeShader > BezierCurveShader

[Geometry shader]

__init__(error=4.0)

Builds a BezierCurveShader object.

Parameters:error (float) – The error we’re allowing for the approximation. This error is the max distance allowed between the new curve and the original geometry.
shade(stroke)

Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation of the original backbone geometry.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.BinaryPredicate0D

Base class for binary predicates working on Interface0D objects. A BinaryPredicate0D is typically an ordering relation between two Interface0D objects. The predicate evaluates a relation between the two Interface0D instances and returns a boolean value (true or false). It is used by invoking the __call__() method.

__init__()

Default constructor.

__call__(inter1, inter2)

Must be overload by inherited classes. It evaluates a relation between two Interface0D objects.

Parameters:
  • inter1 (Interface0D) – The first Interface0D object.
  • inter2 (Interface0D) – The second Interface0D object.
Returns:

True or false.

Return type:

bool

name

The name of the binary 0D predicate.

Type :str
class freestyle.BinaryPredicate1D

Base class for binary predicates working on Interface1D objects. A BinaryPredicate1D is typically an ordering relation between two Interface1D objects. The predicate evaluates a relation between the two Interface1D instances and returns a boolean value (true or false). It is used by invoking the __call__() method.

__init__()

Default constructor.

__call__(inter1, inter2)

Must be overload by inherited classes. It evaluates a relation between two Interface1D objects.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

True or false.

Return type:

bool

name

The name of the binary 1D predicate.

Type :str
class freestyle.CalligraphicShader

Class hierarchy: StrokeShader > CalligraphicShader

[Thickness Shader]

__init__(thickness_min, thickness_max, orientation, clamp)

Builds a CalligraphicShader object.

Parameters:
  • thickness_min (float) – The minimum thickness in the direction perpendicular to the main direction.
  • thickness_max (float) – The maximum thickness in the main direction.
  • orientation (mathutils.Vector) – The 2D vector giving the main direction.
  • clamp (bool) – If true, the strokes are drawn in black when the stroke direction is between -90 and 90 degrees with respect to the main direction and drawn in white otherwise. If false, the strokes are always drawn in black.
shade(stroke)

Assigns thicknesses to the stroke vertices so that the stroke looks like made with a calligraphic tool, i.e. the stroke will be the thickest in a main direction, and the thinest in the direction perpendicular to this one, and an interpolation inbetween.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.Chain

Class hierarchy: Interface1D > Curve > Chain

Class to represent a 1D elements issued from the chaining process. A Chain is the last step before the Stroke and is used in the Splitting and Creation processes.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (Chain) – A Chain object.
__init__(id)

Builds a chain from its Id.

Parameters:id (Id) – An Id object.
push_viewedge_back(viewedge, orientation)

Adds a ViewEdge at the end of the Chain.

Parameters:
  • viewedge (ViewEdge) – The ViewEdge that must be added.
  • orientation (bool) – The orientation with which the ViewEdge must be processed.
push_viewedge_front(viewedge, orientation)

Adds a ViewEdge at the beginning of the Chain.

Parameters:
  • viewedge (ViewEdge) – The ViewEdge that must be added.
  • orientation (bool) – The orientation with which the ViewEdge must be processed.
class freestyle.ChainPredicateIterator

Class hierarchy: Iterator > ViewEdgeIterator > ChainingIterator > ChainPredicateIterator

A “generic” user-controlled ViewEdge iterator. This iterator is in particular built from a unary predicate and a binary predicate. First, the unary predicate is evaluated for all potential next ViewEdges in order to only keep the ones respecting a certain constraint. Then, the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the previous selection. The first ViewEdge respecting both the unary predicate and the binary predicate is kept as the next one. If none of the potential next ViewEdge respects these two predicates, None is returned.

__init__(restrict_to_selection=True, restrict_to_unvisited=True, begin=None, orientation=True)

Builds a ChainPredicateIterator from a starting ViewEdge and its orientation.

Parameters:
  • restrict_to_selection (bool) – Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
  • restrict_to_unvisited (bool) – Indicates whether a ViewEdge that has already been chained must be ignored ot not.
  • begin (ViewEdge or None) – The ViewEdge from where to start the iteration.
  • orientation (bool) – If true, we’ll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin. If false, we’ll search over the ViewEdges surrounding the ending ViewVertex of begin.
__init__(upred, bpred, restrict_to_selection=True, restrict_to_unvisited=True, begin=None, orientation=True)

Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting ViewEdge and its orientation.

Parameters:
  • upred (UnaryPredicate1D) – The unary predicate that the next ViewEdge must satisfy.
  • bpred (BinaryPredicate1D) – The binary predicate that the next ViewEdge must satisfy together with the actual pointed ViewEdge.
  • restrict_to_selection (bool) – Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
  • restrict_to_unvisited (bool) – Indicates whether a ViewEdge that has already been chained must be ignored ot not.
  • begin (ViewEdge or None) – The ViewEdge from where to start the iteration.
  • orientation (bool) – If true, we’ll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin. If false, we’ll search over the ViewEdges surrounding the ending ViewVertex of begin.
__init__(brother)

Copy constructor.

Parameters:brother (ChainPredicateIterator) – A ChainPredicateIterator object.
class freestyle.ChainSilhouetteIterator

Class hierarchy: Iterator > ViewEdgeIterator > ChainingIterator > ChainSilhouetteIterator

A ViewEdge Iterator used to follow ViewEdges the most naturally. For example, it will follow visible ViewEdges of same nature. As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette and Crease, there will be a precedence of the silhouette over the crease criterion.

__init__(restrict_to_selection=True, begin=None, orientation=True)

Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its orientation.

Parameters:
  • restrict_to_selection (bool) – Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
  • begin (ViewEdge or None) – The ViewEdge from where to start the iteration.
  • orientation (bool) – If true, we’ll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin. If false, we’ll search over the ViewEdges surrounding the ending ViewVertex of begin.
__init__(brother)

Copy constructor.

Parameters:brother (ChainSilhouetteIterator) – A ChainSilhouetteIterator object.
class freestyle.ChainingIterator

Class hierarchy: Iterator > ViewEdgeIterator > ChainingIterator

Base class for chaining iterators. This class is designed to be overloaded in order to describe chaining rules. It makes the description of chaining rules easier. The two main methods that need to overloaded are traverse() and init(). traverse() tells which ViewEdge to follow, among the adjacent ones. If you specify restriction rules (such as “Chain only ViewEdges of the selection”), they will be included in the adjacency iterator (i.e, the adjacent iterator will only stop on “valid” edges).

__init__(restrict_to_selection=True, restrict_to_unvisited=True, begin=None, orientation=True)

Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation.

Parameters:
  • restrict_to_selection (bool) – Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
  • restrict_to_unvisited (bool) – Indicates whether a ViewEdge that has already been chained must be ignored ot not.
  • begin (ViewEdge or None) – The ViewEdge from which to start the chain.
  • orientation (bool) – The direction to follow to explore the graph. If true, the direction indicated by the first ViewEdge is used.
__init__(brother)

Copy constructor.

Parameters:brother (ChainingIterator) –
init()

Initializes the iterator context. This method is called each time a new chain is started. It can be used to reset some history information that you might want to keep.

traverse(it)

This method iterates over the potential next ViewEdges and returns the one that will be followed next. Returns the next ViewEdge to follow or None when the end of the chain is reached.

Parameters:it (AdjacencyIterator) – The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge. The adjacency iterator reflects the restriction rules by only iterating over the valid ViewEdges.
Returns:Returns the next ViewEdge to follow, or None if chaining ends.
Return type:ViewEdge or None
is_incrementing

True if the current iteration is an incrementation.

Type :bool
next_vertex

The ViewVertex that is the next crossing.

Type :ViewVertex
object

The ViewEdge object currently pointed by this iterator.

Type :ViewEdge
class freestyle.ChainingTimeStampF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVoid > ChainingTimeStampF1D

__init__()

Builds a ChainingTimeStampF1D object.

__call__(inter)

Sets the chaining time stamp of the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
class freestyle.ColorNoiseShader

Class hierarchy: StrokeShader > ColorNoiseShader

[Color shader]

__init__(amplitude, period)

Builds a ColorNoiseShader object.

Parameters:
  • amplitude (float) – The amplitude of the noise signal.
  • period (float) – The period of the noise signal.
shade(stroke)

Shader to add noise to the stroke colors.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ColorVariationPatternShader

Class hierarchy: StrokeShader > ColorVariationPatternShader

[Color shader]

__init__(pattern_name, stretch=True)

Builds a ColorVariationPatternShader object.

Parameters:
  • pattern_name (str) – The file name of the texture file to use as pattern.
  • stretch (bool) – Tells whether the texture must be strecthed or repeted to fit the stroke.
shade(stroke)

Applies a pattern to vary the original color. The new color is the result of the multiplication of the pattern and the original color.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ConstantColorShader

Class hierarchy: StrokeShader > ConstantColorShader

[Color shader]

__init__(red, green, blue, alpha=1.0)

Builds a ConstantColorShader object.

Parameters:
  • red (float) – The red component.
  • green (float) – The green component.
  • blue (float) – The blue component.
  • alpha (float) – The alpha value.
shade(stroke)

Assigns a constant color to every vertex of the Stroke.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ConstantThicknessShader

Class hierarchy: StrokeShader > ConstantThicknessShader

[Thickness shader]

__init__(thickness)

Builds a ConstantThicknessShader object.

Parameters:thickness (float) – The thickness that must be assigned to the stroke.
shade(stroke)

Assigns an absolute constant thickness to every vertex of the Stroke.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ConstrainedIncreasingThicknessShader

Class hierarchy: StrokeShader > ConstrainedIncreasingThicknessShader

[Thickness shader]

__init__(thickness_min, thickness_max, ratio)

Builds a ConstrainedIncreasingThicknessShader object.

Parameters:
  • thickness_min (float) – The minimum thickness.
  • thickness_max (float) – The maximum thickness.
  • ratio (float) – The thickness/length ratio that we don’t want to exceed.
shade(stroke)

Same as the IncreasingThicknessShader, but here we allow the user to control the thickness/length ratio so that we don’t get fat short lines.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ContourUP1D

Class hierarchy: UnaryPredicate1D > ContourUP1D

__call__(inter)

Returns true if the Interface1D is a contour. An Interface1D is a contour if it is borded by a different shape on each of its sides.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if the Interface1D is a contour, false otherwise.
Return type:bool
class freestyle.Curvature2DAngleF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > Curvature2DAngleF0D

__init__()

Builds a Curvature2DAngleF0D object.

__call__(it)

Returns a real value giving the 2D curvature (as an angle) of the 1D element to which the Interface0D pointed by the Interface0DIterator belongs. The 2D curvature is evaluated at the Interface0D.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The 2D curvature of the 1D element evaluated at the pointed Interface0D.
Return type:float
class freestyle.Curvature2DAngleF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > Curvature2DAngleF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a Curvature2DAngleF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the 2D curvature as an angle for an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The 2D curvature as an angle.
Return type:float
class freestyle.Curve

Class hierarchy: Interface1D > Curve

Base class for curves made of CurvePoints. SVertex is the type of the initial curve vertices. A Chain is a specialization of a Curve.

__init__()

Default Constructor.

__init__(brother)

Copy Constructor.

Parameters:brother (Curve) – A Curve object.
__init__(id)

Builds a Curve from its Id.

Parameters:id (Id) – An Id object.
push_vertex_back(vertex)

Adds a single vertex at the end of the Curve.

Parameters:vertex (SVertex or CurvePoint) – A vertex object.
push_vertex_front(vertex)

Adds a single vertex at the front of the Curve.

Parameters:vertex (SVertex or CurvePoint) – A vertex object.
is_empty

True if the Curve doesn’t have any Vertex yet.

Type :bool
segments_size

The number of segments in the polyline constituing the Curve.

Type :int
class freestyle.CurveNatureF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DEdgeNature > CurveNatureF0D

__init__()

Builds a CurveNatureF0D object.

__call__(it)

Returns the Nature of the 1D element the Interface0D pointed by the Interface0DIterator belongs to.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The nature of the 1D element to which the pointed Interface0D belongs.
Return type:Nature
class freestyle.CurveNatureF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DEdgeNature > CurveNatureF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a CurveNatureF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the nature of the Interface1D (silhouette, ridge, crease, and so on). Except if the Interface1D is a ViewEdge, this result might be ambiguous. Indeed, the Interface1D might result from the gathering of several 1D elements, each one being of a different nature. An integration method, such as the MEAN, might give, in this case, irrelevant results.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The nature of the Interface1D.
Return type:Nature
class freestyle.CurvePoint

Class hierarchy: Interface0D > CurvePoint

Class to represent a point of a curve. A CurvePoint can be any point of a 1D curve (it doesn’t have to be a vertex of the curve). Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is basically a polyline made of a list of SVertex objects. Thus, a CurvePoint is built by linearly interpolating two SVertex instances. CurvePoint can be used as virtual points while querying 0D information along a curve at a given resolution.

__init__()

Defult constructor.

__init__(brother)

Copy constructor.

Parameters:brother (CurvePoint) – A CurvePoint object.
__init__(first_vertex, second_vertex, t2d)

Builds a CurvePoint from two SVertex objects and an interpolation parameter.

Parameters:
  • first_vertex (SVertex) – The first SVertex.
  • second_vertex (SVertex) – The second SVertex.
  • t2d (float) – A 2D interpolation parameter used to linearly interpolate first_vertex and second_vertex.
__init__(first_point, second_point, t2d)

Builds a CurvePoint from two CurvePoint objects and an interpolation parameter.

Parameters:
  • first_point (CurvePoint) – The first CurvePoint.
  • second_point (CurvePoint) – The second CurvePoint.
  • t2d (float) – The 2D interpolation parameter used to linearly interpolate first_point and second_point.
curvature_fredo

The angle (Fredo’s curvature) in radians.

Type :float
first_svertex

The first SVertex upon which the CurvePoint is built.

Type :int
second_svertex

The second SVertex upon which the CurvePoint is built.

Type :int
t2d

The 2D interpolation parameter.

Type :float
class freestyle.CurvePointIterator

Class hierarchy: Iterator > CurvePointIterator

Class representing an iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is instanciated and returned through the .object attribute.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (CurvePointIterator) – A CurvePointIterator object.
__init__(step=0.0)

Builds a CurvePointIterator object.

Parameters:step (float) – A resampling resolution with which the curve is resampled. If zero, no resampling is done (i.e., the iterator iterates over initial vertices).
object

The CurvePoint object currently pointed by this iterator.

Type :CurvePoint
t

The curvilinear abscissa of the current point.

Type :float
u

The point parameter at the current point in the stroke (0 <= u <= 1).

Type :float
class freestyle.DensityF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > DensityF0D

__init__(sigma=2.0)

Builds a DensityF0D object.

Parameters:sigma (float) – The gaussian sigma value indicating the X value for which the gaussian function is 0.5. It leads to the window size value (the larger, the smoother).
__call__(it)

Returns the density of the (result) image evaluated at the Interface0D pointed by the Interface0DIterator. This density is evaluated using a pixels square window around the evaluation point and integrating these values using a gaussian.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The density of the image evaluated at the pointed Interface0D.
Return type:float
class freestyle.DensityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > DensityF1D

__init__(sigma=2.0, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a DensityF1D object.

Parameters:
  • sigma (float) – The sigma used in DensityF0D and determining the window size used in each density query.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter)

Returns the density evaluated for an Interface1D. The density is evaluated for a set of points along the Interface1D (using the DensityF0D functor) with a user-defined sampling and then integrated into a single value using a user-defined integration method.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The density evaluated for an Interface1D.
Return type:float
class freestyle.DensityLowerThanUP1D

Class hierarchy: UnaryPredicate1D > DensityLowerThanUP1D

__init__(threshold, sigma=2.0)

Builds a DensityLowerThanUP1D object.

Parameters:
  • threshold (float) – The value of the threshold density. Any Interface1D having a density lower than this threshold will match.
  • sigma (float) – The sigma value defining the density evaluation window size used in the DensityF0D functor.
__call__(inter)

Returns true if the density evaluated for the Interface1D is less than a user-defined density value.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if the density is lower than a threshold.
Return type:bool
class freestyle.EqualToChainingTimeStampUP1D

Class hierarchy: UnaryPredicate1D > EqualToChainingTimeStampUP1D

__init__(ts)

Builds a EqualToChainingTimeStampUP1D object.

Parameters:ts (int) – A time stamp value.
__call__(inter)

Returns true if the Interface1D’s time stamp is equal to a certain user-defined value.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if the time stamp is equal to a user-defined value.
Return type:bool
class freestyle.EqualToTimeStampUP1D

Class hierarchy: UnaryPredicate1D > EqualToTimeStampUP1D

__init__(ts)

Builds a EqualToTimeStampUP1D object.

Parameters:ts (int) – A time stamp value.
__call__(inter)

Returns true if the Interface1D’s time stamp is equal to a certain user-defined value.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if the time stamp is equal to a user-defined value.
Return type:bool
class freestyle.ExternalContourUP1D

Class hierarchy: UnaryPredicate1D > ExternalContourUP1D

__call__(inter)

Returns true if the Interface1D is an external contour. An Interface1D is an external contour if it is borded by no shape on one of its sides.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if the Interface1D is an external contour, false otherwise.
Return type:bool
class freestyle.FEdge

Class hierarchy: Interface1D > FEdge

Base Class for feature edges. This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive contour. For silhouettes, the FEdge is oriented so that the visible face lies on the left of the edge. For borders, the FEdge is oriented so that the face lies on the left of the edge. An FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh depending on the smoothness or sharpness of the mesh. This class is specialized into a smooth and a sharp version since their properties slightly vary from one to the other.

FEdge()

Default constructor.

FEdge(brother)

Copy constructor.

Parameters:brother (FEdge) – An FEdge object.
FEdge(first_vertex, second_vertex)

Builds an FEdge going from the first vertex to the second.

Parameters:
  • first_vertex (SVertex) – The first SVertex.
  • second_vertex (SVertex) – The second SVertex.
first_svertex

The first SVertex constituting this FEdge.

Type :SVertex
id

The Id of this FEdge.

Type :Id
is_smooth

True if this FEdge is a smooth FEdge.

Type :bool
nature

The nature of this FEdge.

Type :Nature
next_fedge

The FEdge following this one in the ViewEdge. The value is None if this FEdge is the last of the ViewEdge.

Type :FEdge
previous_fedge

The FEdge preceding this one in the ViewEdge. The value is None if this FEdge is the first one of the ViewEdge.

Type :FEdge
second_svertex

The second SVertex constituting this FEdge.

Type :SVertex
viewedge

The ViewEdge to which this FEdge belongs to.

Type :ViewEdge
class freestyle.FEdgeSharp

Class hierarchy: Interface1D > FEdge > FEdgeSharp

Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial edge of the input mesh. It can be a silhouette, a crease or a border. If it is a crease edge, then it is borded by two faces of the mesh. Face a lies on its right whereas Face b lies on its left. If it is a border edge, then it doesn’t have any face on its right, and thus Face a is None.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (FEdgeSharp) – An FEdgeSharp object.
__init__(first_vertex, second_vertex)

Builds an FEdgeSharp going from the first vertex to the second.

Parameters:
  • first_vertex (SVertex) – The first SVertex object.
  • second_vertex (SVertex) – The second SVertex object.
face_mark_left

The face mark of the face lying on the left of the FEdge.

Type :bool
face_mark_right

The face mark of the face lying on the right of the FEdge. If this FEdge is a border, it has no face on the right and thus this property is set to false.

Type :bool
material_index_left

The index of the material of the face lying on the left of the FEdge.

Type :int
material_index_right

The index of the material of the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore no material.

Type :int
material_left

The material of the face lying on the left of the FEdge.

Type :Material
material_right

The material of the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore no material.

Type :Material
normal_left

The normal to the face lying on the left of the FEdge.

Type :mathutils.Vector
normal_right

The normal to the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore no normal.

Type :mathutils.Vector
class freestyle.FEdgeSmooth

Class hierarchy: Interface1D > FEdge > FEdgeSmooth

Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. It can be a silhouette, a ridge or valley, a suggestive contour.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (FEdgeSmooth) – An FEdgeSmooth object.
__init__(first_vertex, second_vertex)

Builds an FEdgeSmooth going from the first to the second.

Parameters:
  • first_vertex (SVertex) – The first SVertex object.
  • second_vertex (SVertex) – The second SVertex object.
face_mark

The face mark of the face that this FEdge is running across.

Type :bool
material

The material of the face that this FEdge is running across.

Type :Material
material_index

The index of the material of the face that this FEdge is running across.

Type :int
normal

The normal of the face that this FEdge is running across.

Type :mathutils.Vector
class freestyle.FalseBP1D

Class hierarchy: BinaryPredicate1D > FalseBP1D

__call__(inter1, inter2)

Always returns false.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

False.

Return type:

bool

class freestyle.FalseUP0D

Class hierarchy: UnaryPredicate0D > FalseUP0D

__call__(it)

Always returns false.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:False.
Return type:bool
class freestyle.FalseUP1D

Class hierarchy: UnaryPredicate1D > FalseUP1D

__call__(inter)

Always returns false.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:False.
Return type:bool
class freestyle.GetCompleteViewMapDensityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetCompleteViewMapDensityF1D

__init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a GetCompleteViewMapDensityF1D object.

Parameters:
  • level (int) – The level of the pyramid from which the pixel must be read.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter)

Returns the density evaluated for an Interface1D in the complete viewmap image. The density is evaluated for a set of points along the Interface1D (using the ReadCompleteViewMapPixelF0D functor) and then integrated into a single value using a user-defined integration method.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The density evaluated for the Interface1D in the complete viewmap image.
Return type:float
class freestyle.GetCurvilinearAbscissaF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > GetCurvilinearAbscissaF0D

__init__()

Builds a GetCurvilinearAbscissaF0D object.

__call__(it)

Returns the curvilinear abscissa of the Interface0D pointed by the Interface0DIterator in the context of its 1D element.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The curvilinear abscissa of the pointed Interface0D.
Return type:float
class freestyle.GetDirectionalViewMapDensityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetDirectionalViewMapDensityF1D

__init__(orientation, level, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a GetDirectionalViewMapDensityF1D object.

Parameters:
  • orientation (int) – The number of the directional map we must work with.
  • level (int) – The level of the pyramid from which the pixel must be read.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter)

Returns the density evaluated for an Interface1D in of the steerable viewmaps image. The direction telling which Directional map to choose is explicitely specified by the user. The density is evaluated for a set of points along the Interface1D (using the ReadSteerableViewMapPixelF0D functor) and then integrated into a single value using a user-defined integration method.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:the density evaluated for an Interface1D in of the steerable viewmaps image.
Return type:float
class freestyle.GetOccludeeF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DViewShape > GetOccludeeF0D

__init__()

Builds a GetOccludeeF0D object.

__call__(it)

Returns the ViewShape that the Interface0D pointed by the Interface0DIterator occludes.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The ViewShape occluded by the pointed Interface0D.
Return type:ViewShape
class freestyle.GetOccludeeF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVectorViewShape > GetOccludeeF1D

__init__()

Builds a GetOccludeeF1D object.

__call__(inter)

Returns a list of occluded shapes covered by this Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:A list of occluded shapes covered by the Interface1D.
Return type:list of ViewShape objects
class freestyle.GetOccludersF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DVectorViewShape > GetOccludersF0D

__init__()

Builds a GetOccludersF0D object.

__call__(it)

Returns a list of ViewShape objects occluding the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:A list of ViewShape objects occluding the pointed Interface0D.
Return type:list of ViewShape objects
class freestyle.GetOccludersF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVectorViewShape > GetOccludersF1D

__init__()

Builds a GetOccludersF1D object.

__call__(inter)

Returns a list of occluding shapes that cover this Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:A list of occluding shapes that cover the Interface1D.
Return type:list of ViewShape objects
class freestyle.GetParameterF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > GetParameterF0D

__init__()

Builds a GetParameterF0D object.

__call__(it)

Returns the parameter of the Interface0D pointed by the Interface0DIterator in the context of its 1D element.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The parameter of an Interface0D.
Return type:float
class freestyle.GetProjectedXF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetProjectedXF0D

__init__()

Builds a GetProjectedXF0D object.

__call__(it)

Returns the X 3D projected coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The X 3D projected coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetProjectedXF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetProjectedXF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetProjectedXF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the projected X 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The projected X 3D coordinate of an Interface1D.
Return type:float
class freestyle.GetProjectedYF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetProjectedYF0D

__init__()

Builds a GetProjectedYF0D object.

__call__(it)

Returns the Y 3D projected coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The Y 3D projected coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetProjectedYF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetProjectedYF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetProjectedYF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the projected Y 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The projected Y 3D coordinate of an Interface1D.
Return type:float
class freestyle.GetProjectedZF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetProjectedZF0D

__init__()

Builds a GetProjectedZF0D object.

__call__(it)

Returns the Z 3D projected coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The Z 3D projected coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetProjectedZF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetProjectedZF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetProjectedZF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the projected Z 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The projected Z 3D coordinate of an Interface1D.
Return type:float
class freestyle.GetShapeF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DViewShape > GetShapeF0D

__init__()

Builds a GetShapeF0D.cpp object.

__call__(it)

Returns the ViewShape containing the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The ViewShape containing the pointed Interface0D.
Return type:ViewShape
class freestyle.GetShapeF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVectorViewShape > GetShapeF1D

__init__()

Builds a GetShapeF1D object.

__call__(inter)

Returns a list of shapes covered by this Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:A list of shapes covered by the Interface1D.
Return type:list of ViewShape objects
class freestyle.GetSteerableViewMapDensityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetSteerableViewMapDensityF1D

__init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a GetSteerableViewMapDensityF1D object.

Parameters:
  • level (int) – The level of the pyramid from which the pixel must be read.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter)

Returns the density of the ViewMap for a given Interface1D. The density of each FEdge is evaluated in the proper steerable ViewMap depending on its orientation.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The density of the ViewMap for a given Interface1D.
Return type:float
class freestyle.GetViewMapGradientNormF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > GetViewMapGradientNormF0D

__init__(level)

Builds a GetViewMapGradientNormF0D object.

Parameters:level (int) – The level of the pyramid from which the pixel must be read.
__call__(it)

Returns the norm of the gradient of the global viewmap density image.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The norm of the gradient of the global viewmap density image.
Return type:float
class freestyle.GetViewMapGradientNormF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetViewMapGradientNormF1D

__init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a GetViewMapGradientNormF1D object.

Parameters:
  • level (int) – The level of the pyramid from which the pixel must be read.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter)

Returns the density of the ViewMap for a given Interface1D. The density of each FEdge is evaluated in the proper steerable ViewMap depending on its orientation.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The density of the ViewMap for a given Interface1D.
Return type:float
class freestyle.GetXF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetXF0D

__init__()

Builds a GetXF0D object.

__call__(it)

Returns the X 3D coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The X 3D coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetXF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetXF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetXF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the X 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The X 3D coordinate of the Interface1D.
Return type:float
class freestyle.GetYF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetYF0D

__init__()

Builds a GetYF0D object.

__call__(it)

Returns the Y 3D coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The Y 3D coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetYF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetYF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetYF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the Y 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The Y 3D coordinate of the Interface1D.
Return type:float
class freestyle.GetZF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > GetZF0D

__init__()

Builds a GetZF0D object.

__call__(it)

Returns the Z 3D coordinate of the Interface0D pointed by the Interface0DIterator.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The Z 3D coordinate of the pointed Interface0D.
Return type:float
class freestyle.GetZF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > GetZF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a GetZF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the Z 3D coordinate of an Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The Z 3D coordinate of the Interface1D.
Return type:float
class freestyle.GuidingLinesShader

Class hierarchy: StrokeShader > GuidingLinesShader

[Geometry shader]

__init__(offset)

Builds a GuidingLinesShader object.

Parameters:offset (float) – The line that replaces the stroke is initially in the middle of the initial stroke bounding box. offset is the value of the displacement which is applied to this line along its normal.
shade(stroke)

Shader to modify the Stroke geometry so that it corresponds to its main direction line. This shader must be used together with the splitting operator using the curvature criterion. Indeed, the precision of the approximation will depend on the size of the stroke’s pieces. The bigger the pieces are, the rougher the approximation is.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.Id

Class for representing an object Id.

__init__(first=0, second=0)

Build the Id from two numbers.

Parameters:
  • first (int) – The first number.
  • second (int) – The second number.
__init__(brother)

Copy constructor.

Parameters:brother (Id) – An Id object.
first

The first number constituting the Id.

Type :int
second

The second number constituting the Id.

Type :int
class freestyle.IncreasingColorShader

Class hierarchy: StrokeShader > IncreasingColorShader

[Color shader]

__init__(red_min, green_min, blue_min, alpha_min, red_max, green_max, blue_max, alpha_max)

Builds an IncreasingColorShader object.

Parameters:
  • red_min (float) – The first color red component.
  • green_min (float) – The first color green component.
  • blue_min (float) – The first color blue component.
  • alpha_min (float) – The first color alpha value.
  • red_max (float) – The second color red component.
  • green_max (float) – The second color green component.
  • blue_max (float) – The second color blue component.
  • alpha_max (float) – The second color alpha value.
shade(stroke)

Assigns a varying color to the stroke. The user specifies two colors A and B. The stroke color will change linearly from A to B between the first and the last vertex.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.IncreasingThicknessShader

Class hierarchy: StrokeShader > IncreasingThicknessShader

[Thickness shader]

__init__(thickness_A, thickness_B)

Builds an IncreasingThicknessShader object.

Parameters:
  • thickness_A (float) – The first thickness value.
  • thickness_B (float) – The second thickness value.
shade(stroke)

Assigns thicknesses values such as the thickness increases from a thickness value A to a thickness value B between the first vertex to the midpoint vertex and then decreases from B to a A between this midpoint vertex and the last vertex. The thickness is linearly interpolated from A to B.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.IncrementChainingTimeStampF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVoid > IncrementChainingTimeStampF1D

__init__()

Builds an IncrementChainingTimeStampF1D object.

__call__(inter)

Increments the chaining time stamp of the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
class freestyle.IntegrationType

Class hierarchy: int > IntegrationType

Different integration methods that can be invoked to integrate into a single value the set of values obtained from each 0D element of an 1D element:

  • IntegrationType.MEAN: The value computed for the 1D element is the mean of the values obtained for the 0D elements.
  • IntegrationType.MIN: The value computed for the 1D element is the minimum of the values obtained for the 0D elements.
  • IntegrationType.MAX: The value computed for the 1D element is the maximum of the values obtained for the 0D elements.
  • IntegrationType.FIRST: The value computed for the 1D element is the first of the values obtained for the 0D elements.
  • IntegrationType.LAST: The value computed for the 1D element is the last of the values obtained for the 0D elements.
class freestyle.Interface0D

Base class for any 0D element.

__init__()

Default constructor.

get_fedge(inter)

Returns the FEdge that lies between this 0D element and the 0D element given as the argument.

Parameters:inter (Interface0D) – A 0D element.
Returns:The FEdge lying between the two 0D elements.
Return type:FEdge
id

The Id of this 0D element.

Type :Id
name

The string of the name of this 0D element.

Type :str
nature

The nature of this 0D element.

Type :Nature
point_2d

The 2D point of this 0D element.

Type :mathutils.Vector
point_3d

The 3D point of this 0D element.

Type :mathutils.Vector
projected_x

The X coordinate of the projected 3D point of this 0D element.

Type :float
projected_y

The Y coordinate of the projected 3D point of this 0D element.

Type :float
projected_z

The Z coordinate of the projected 3D point of this 0D element.

Type :float
class freestyle.Interface0DIterator

Class hierarchy: Iterator > Interface0DIterator

Class defining an iterator over Interface0D elements. An instance of this iterator is always obtained from a 1D element.

__init__(brother)

Copy constructor.

Parameters:brother (Interface0DIterator) – An Interface0DIterator object.
__init__(it)

Construct a nested Interface0DIterator that can be the argument of a Function0D.

Parameters:it (SVertexIterator, CurvePointIterator, or StrokeVertexIterator) – An iterator object to be nested.
object

The Interface0D object currently pointed by this iterator.

Type :Interface0D
t

The curvilinear abscissa of the current point.

Type :float
u

The point parameter at the current point in the 1D element (0 <= u <= 1).

Type :float
class freestyle.Interface1D

Base class for any 1D element.

__init__()

Default constructor.

points_begin(t=0.0)

Returns an iterator over the Interface1D points, pointing to the first point. The difference with vertices_begin() 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:t (float) – A sampling with which we want to iterate over points of this 1D element.
Returns:An Interface0DIterator pointing to the first point.
Return type:Interface0DIterator
points_end(t=0.0)

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

Parameters:t (float) – A sampling with which we want to iterate over points of this 1D element.
Returns:An Interface0DIterator pointing after the last point.
Return type:Interface0DIterator
vertices_begin()

Returns an iterator over the Interface1D vertices, pointing to the first vertex.

Returns:An Interface0DIterator pointing to the first vertex.
Return type:Interface0DIterator
vertices_end()

Returns an iterator over the Interface1D vertices, pointing after the last vertex.

Returns:An Interface0DIterator pointing after the last vertex.
Return type:Interface0DIterator
id

The Id of this Interface1D.

Type :Id
length_2d

The 2D length of this Interface1D.

Type :float
name

The string of the name of the 1D element.

Type :str
nature

The nature of this Interface1D.

Type :Nature
time_stamp

The time stamp of the 1D element, mainly used for selection.

Type :int
class freestyle.Iterator

Base class to define iterators.

__init__()

Default constructor.

decrement()

Makes the iterator point the previous element.

increment()

Makes the iterator point the next element.

is_begin

True if the interator points the first element.

Type :bool
is_end

True if the interator points the last element.

Type :bool
name

The string of the name of this iterator.

Type :str
class freestyle.Length2DBP1D

Class hierarchy: BinaryPredicate1D > Length2DBP1D

__call__(inter1, inter2)

Returns true if the 2D length of inter1 is less than the 2D length of inter2.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

True or false.

Return type:

bool

class freestyle.LocalAverageDepthF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > LocalAverageDepthF0D

__init__(mask_size=5.0)

Builds a LocalAverageDepthF0D object.

Parameters:mask_size (float) – The size of the mask.
__call__(it)

Returns the average depth around the Interface0D pointed by the Interface0DIterator. The result is obtained by querying the depth buffer on a window around that point.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The average depth around the pointed Interface0D.
Return type:float
class freestyle.LocalAverageDepthF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > LocalAverageDepthF1D

__init__(sigma, integration_type=IntegrationType.MEAN)

Builds a LocalAverageDepthF1D object.

Parameters:
  • sigma (float) – The sigma used in DensityF0D and determining the window size used in each density query.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the average depth evaluated for an Interface1D. The average depth is evaluated for a set of points along the Interface1D (using the LocalAverageDepthF0D functor) with a user-defined sampling and then integrated into a single value using a user-defined integration method.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The average depth evaluated for the Interface1D.
Return type:float
class freestyle.Material

Class defining a material.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (Material) – A Material object.
__init__(diffuse, ambient, specular, emission, shininess)

Builds a Material from its diffuse, ambient, specular, emissive colors and a shininess coefficient.

Parameters:
  • diffuse (mathutils.Vector, list or tuple of 4 float values) – The diffuse color.
  • ambient (mathutils.Vector, list or tuple of 4 float values) – The ambient color.
  • specular (mathutils.Vector, list or tuple of 4 float values) – The specular color.
  • emission (mathutils.Vector, list or tuple of 4 float values) – The emissive color.
  • shininess (:class:float) – The shininess coefficient.
ambient

RGBA components of the ambient color of the material.

Type :mathutils.Color
diffuse

RGBA components of the diffuse color of the material.

Type :mathutils.Vector
emission

RGBA components of the emissive color of the material.

Type :mathutils.Color
shininess

Shininess coefficient of the material.

Type :float
specular

RGBA components of the specular color of the material.

Type :mathutils.Vector
class freestyle.MaterialF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DMaterial > MaterialF0D

__init__()

Builds a MaterialF0D object.

__call__(it)

Returns the material of the object evaluated at the Interface0D pointed by the Interface0DIterator. This evaluation can be ambiguous (in the case of a TVertex for example. This functor tries to remove this ambiguity using the context offered by the 1D element to which the Interface0DIterator belongs to and by arbitrary chosing the material of the face that lies on its left when following the 1D element if there are two different materials on each side of the point. However, there still can be problematic cases, and the user willing to deal with this cases in a specific way should implement its own getMaterial functor.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The material of the object evaluated at the pointed Interface0D.
Return type:Material
class freestyle.MediumType

Class hierarchy: int > MediumType

The different blending modes available to similate the interaction media-medium:

  • Stroke.DRY_MEDIUM: To simulate a dry medium such as Pencil or Charcoal.
  • Stroke.HUMID_MEDIUM: To simulate ink painting (color substraction blending).
  • Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...).
class freestyle.Nature

Class hierarchy: int > Nature

Different possible natures of 0D and 1D elements of the ViewMap.

Vertex natures:

  • Nature.POINT: True for any 0D element.
  • Nature.S_VERTEX: True for SVertex.
  • Nature.VIEW_VERTEX: True for ViewVertex.
  • Nature.NON_T_VERTEX: True for NonTVertex.
  • Nature.T_VERTEX: True for TVertex.
  • Nature.CUSP: True for CUSP.

Edge natures:

  • Nature.NO_FEATURE: True for non feature edges (always false for 1D elements of the ViewMap).
  • Nature.SILHOUETTE: True for silhouettes.
  • Nature.BORDER: True for borders.
  • Nature.CREASE: True for creases.
  • Nature.RIDGE: True for ridges.
  • Nature.VALLEY: True for valleys.
  • Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.
  • Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.
  • Nature.EDGE_MARK: True for edges having user-defined edge marks.
class freestyle.Noise

Class to provide Perlin noise functionalities.

__init__(seed = -1)

Builds a Noise object. Seed is an optional argument. The seed value is used as a seed for random number generation if it is equal to or greater than zero; otherwise, time is used as a seed.

Parameters:seed (int) – Seed for random number generation.
smoothNoise1(v)

Returns a smooth noise value for a 1D element.

Parameters:v (float) – One-dimensional sample point.
Returns:A smooth noise value.
Return type:float
smoothNoise2(v)

Returns a smooth noise value for a 2D element.

Parameters:v (mathutils.Vector, list or tuple of 2 real numbers) – Two-dimensional sample point.
Returns:A smooth noise value.
Return type:float
smoothNoise3(v)

Returns a smooth noise value for a 3D element.

Parameters:v (mathutils.Vector, list or tuple of 3 real numbers) – Three-dimensional sample point.
Returns:A smooth noise value.
Return type:float
turbulence1(v, freq, amp, oct=4)

Returns a noise value for a 1D element.

Parameters:
  • v (float) – One-dimensional sample point.
  • freq (float) – Noise frequency.
  • amp (float) – Amplitude.
  • oct (int) – Number of octaves.
Returns:

A noise value.

Return type:

float

turbulence2(v, freq, amp, oct=4)

Returns a noise value for a 2D element.

Parameters:
  • v (mathutils.Vector, list or tuple of 2 real numbers) – Two-dimensional sample point.
  • freq (float) – Noise frequency.
  • amp (float) – Amplitude.
  • oct (int) – Number of octaves.
Returns:

A noise value.

Return type:

float

turbulence3(v, freq, amp, oct=4)

Returns a noise value for a 3D element.

Parameters:
  • v (mathutils.Vector, list or tuple of 3 real numbers) – Three-dimensional sample point.
  • freq (float) – Noise frequency.
  • amp (float) – Amplitude.
  • oct (int) – Number of octaves.
Returns:

A noise value.

Return type:

float

class freestyle.NonTVertex

Class hierarchy: Interface0D > ViewVertex > NonTVertex

View vertex for corners, cusps, etc. associated to a single SVertex. Can be associated to 2 or more view edges.

__init__()

Default constructor.

__init__(svertex)

Build a NonTVertex from a SVertex.

Parameters:svertex (SVertex) – An SVertex object.
svertex

The SVertex on top of which this NonTVertex is built.

Type :SVertex
class freestyle.Normal2DF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DVec2f > Normal2DF0D

__init__()

Builds a Normal2DF0D object.

__call__(it)

Returns a two-dimensional vector giving the normalized 2D normal to the 1D element to which the Interface0D pointed by the Interface0DIterator belongs. The normal is evaluated at the pointed Interface0D.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The 2D normal of the 1D element evaluated at the pointed Interface0D.
Return type:mathutils.Vector
class freestyle.Normal2DF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVec2f > Normal2DF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a Normal2DF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the 2D normal for the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The 2D normal for the Interface1D.
Return type:mathutils.Vector
class freestyle.Operators

Class defining the operators used in a style module. There are five types of operators: Selection, chaining, splitting, sorting and creation. All these operators are user controlled through functors, predicates and shaders that are taken as arguments.

static bidirectional_chain(it, pred)

Builds a set of chains from the current set of ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator iterates both using the increment and decrement operators and is therefore bidirectional. This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can be told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track of the number of chains to which a ViewEdge belongs to.

Parameters:
  • it (ChainingIterator) – The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
  • pred (UnaryPredicate1D) – The predicate on the ViewEdge that expresses the stopping condition.
static bidirectional_chain(it)

The only difference with the above bidirectional chaining algorithm is that we don’t need to pass a stopping criterion. This might be desirable when the stopping criterion is already contained in the iterator definition. Builds a set of chains from the current set of ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator iterates both using the increment and decrement operators and is therefore bidirectional. This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can be told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track of the number of chains to which a ViewEdge belongs to.

Parameters:it (ChainingIterator) – The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
static chain(it, pred, modifier)

Builds a set of chains from the current set of ViewEdges. Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator only iterates using the increment operator and is therefore unidirectional.

Parameters:
  • it (ViewEdgeIterator) – The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
  • pred (UnaryPredicate1D) – The predicate on the ViewEdge that expresses the stopping condition.
  • modifier (UnaryFunction1DVoid) – A function that takes a ViewEdge as argument and that is used to modify the processed ViewEdge state (the timestamp incrementation is a typical illustration of such a modifier).
static chain(it, pred)

Builds a set of chains from the current set of ViewEdges. Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator only iterates using the increment operator and is therefore unidirectional. This chaining operator is different from the previous one because it doesn’t take any modifier as argument. Indeed, the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in this case.

Parameters:
  • it (ViewEdgeIterator) – The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
  • pred (UnaryPredicate1D) – The predicate on the ViewEdge that expresses the stopping condition.
static create(pred, shaders)

Creates and shades the strokes from the current set of chains. A predicate can be specified to make a selection pass on the chains.

Parameters:
  • pred (UnaryPredicate1D) – The predicate that a chain must verify in order to be transform as a stroke.
  • shaders (List of StrokeShader objects) – The list of shaders used to shade the strokes.
static get_chain_from_index(i)

Returns the Chain at the index in the current set of Chains.

Parameters:i (int) – index (0 <= i < Operators.get_chains_size()).
Returns:The Chain object.
Return type:Chain
static get_chains_size()

Returns the number of Chains.

Returns:The number of Chains.
Return type:int
static get_stroke_from_index(i)

Returns the Stroke at the index in the current set of Strokes.

Parameters:i (int) – index (0 <= i < Operators.get_strokes_size()).
Returns:The Stroke object.
Return type:Stroke
static get_strokes_size()

Returns the number of Strokes.

Returns:The number of Strokes.
Return type:int
static get_view_edges_size()

Returns the number of ViewEdges.

Returns:The number of ViewEdges.
Return type:int
static get_viewedge_from_index(i)

Returns the ViewEdge at the index in the current set of ViewEdges.

Parameters:i (int) – index (0 <= i < Operators.get_view_edges_size()).
Returns:The ViewEdge object.
Return type:ViewEdge
static recursive_split(func, pred_1d, sampling=0.0)

Splits the current set of chains in a recursive way. We process the points of each chain (with a specified sampling) to find the point minimizing a specified function. The chain is split in two at this point and the two new chains are processed in the same way. The recursivity level is controlled through a predicate 1D that expresses a stopping condition on the chain that is about to be processed.

Parameters:
  • func (UnaryFunction0DDouble) – The Unary Function evaluated at each point of the chain. The splitting point is the point minimizing this function.
  • pred_1d – The Unary Predicate expressing the recursivity stopping condition. This predicate is evaluated for each curve before it actually gets split. If pred_1d(chain) is true, the curve won’t be split anymore.
  • sampling (float) – The resolution used to sample the chain for the predicates evaluation. (The chain is not actually resampled, a virtual point only progresses along the curve using this resolution.)
static recursive_split(func, pred_0d, pred_1d, sampling=0.0)

Splits the current set of chains in a recursive way. We process the points of each chain (with a specified sampling) to find the point minimizing a specified function. The chain is split in two at this point and the two new chains are processed in the same way. The user can specify a 0D predicate to make a first selection on the points that can potentially be split. A point that doesn’t verify the 0D predicate won’t be candidate in realizing the min. The recursivity level is controlled through a predicate 1D that expresses a stopping condition on the chain that is about to be processed.

Parameters:
  • func (UnaryFunction0DDouble) – The Unary Function evaluated at each point of the chain. The splitting point is the point minimizing this function.
  • pred_0d (UnaryPredicate0D) – The Unary Predicate 0D used to select the candidate points where the split can occur. For example, it is very likely that would rather have your chain splitting around its middle point than around one of its extremities. A 0D predicate working on the curvilinear abscissa allows to add this kind of constraints.
  • pred_1d – The Unary Predicate expressing the recursivity stopping condition. This predicate is evaluated for each curve before it actually gets split. If pred_1d(chain) is true, the curve won’t be split anymore.
  • sampling (float) – The resolution used to sample the chain for the predicates evaluation. (The chain is not actually resampled; a virtual point only progresses along the curve using this resolution.)
static select(pred)

Selects the ViewEdges of the ViewMap verifying a specified condition.

Parameters:pred (UnaryPredicate1D) – The predicate expressing this condition.
static sequential_split(starting_pred, stopping_pred, sampling=0.0)

Splits each chain of the current set of chains in a sequential way. The points of each chain are processed (with a specified sampling) sequentially. Each time a user specified starting condition is verified, a new chain begins and ends as soon as a user-defined stopping predicate is verified. This allows chains overlapping rather than chains partitioning. The first point of the initial chain is the first point of one of the resulting chains. The splitting ends when no more chain can start.

Parameters:
  • starting_pred (UnaryPredicate0D) – The predicate on a point that expresses the starting condition.
  • stopping_pred (UnaryPredicate0D) – The predicate on a point that expresses the stopping condition.
  • sampling (float) – The resolution used to sample the chain for the predicates evaluation. (The chain is not actually resampled; a virtual point only progresses along the curve using this resolution.)
static sequential_split(pred, sampling=0.0)

Splits each chain of the current set of chains in a sequential way. The points of each chain are processed (with a specified sampling) sequentially and each time a user specified condition is verified, the chain is split into two chains. The resulting set of chains is a partition of the initial chain

Parameters:
  • pred (UnaryPredicate0D) – The predicate on a point that expresses the splitting condition.
  • sampling (float) – The resolution used to sample the chain for the predicate evaluation. (The chain is not actually resampled; a virtual point only progresses along the curve using this resolution.)
static sort(pred)

Sorts the current set of chains (or viewedges) according to the comparison predicate given as argument.

Parameters:pred (BinaryPredicate1D) – The binary predicate used for the comparison.
class freestyle.Orientation2DF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVec2f > Orientation2DF1D

__init__(integration_type=IntegrationType.MEAN)

Builds an Orientation2DF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the 2D orientation of the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The 2D orientation of the Interface1D.
Return type:mathutils.Vector
class freestyle.Orientation3DF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVec3f > Orientation3DF1D

__init__(integration_type=IntegrationType.MEAN)

Builds an Orientation3DF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the 3D orientation of the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The 3D orientation of the Interface1D.
Return type:mathutils.Vector
class freestyle.PolygonalizationShader

Class hierarchy: StrokeShader > PolygonalizationShader

[Geometry shader]

__init__(error)

Builds a PolygonalizationShader object.

Parameters:error (float) – The error we want our polygonal approximation to have with respect to the original geometry. The smaller, the closer the new stroke is to the orinal one. This error corresponds to the maximum distance between the new stroke and the old one.
shade(stroke)

Modifies the Stroke geometry so that it looks more “polygonal”. The basic idea is to start from the minimal stroke approximation consisting in a line joining the first vertex to the last one and to subdivide using the original stroke vertices until a certain error is reached.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.QuantitativeInvisibilityF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DUnsigned > QuantitativeInvisibilityF0D

__init__()

Builds a QuantitativeInvisibilityF0D object.

__call__(it)

Returns the quantitative invisibility of the Interface0D pointed by the Interface0DIterator. This evaluation can be ambiguous (in the case of a TVertex for example). This functor tries to remove this ambiguity using the context offered by the 1D element to which the Interface0D belongs to. However, there still can be problematic cases, and the user willing to deal with this cases in a specific way should implement its own getQIF0D functor.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The quantitative invisibility of the pointed Interface0D.
Return type:int
class freestyle.QuantitativeInvisibilityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DUnsigned > QuantitativeInvisibilityF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a QuantitativeInvisibilityF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns the Quantitative Invisibility of an Interface1D element. If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the Interface1D results of a chaining (chain, stroke), then it might be made of several 1D elements of different Quantitative Invisibilities.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The Quantitative Invisibility of the Interface1D.
Return type:int
class freestyle.QuantitativeInvisibilityUP1D

Class hierarchy: UnaryPredicate1D > QuantitativeInvisibilityUP1D

__init__(qi=0)

Builds a QuantitativeInvisibilityUP1D object.

Parameters:qi (int) – The Quantitative Invisibility you want the Interface1D to have.
__call__(inter)

Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the QuantitativeInvisibilityF1D functor, equals a certain user-defined value.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if Quantitative Invisibility equals a user-defined value.
Return type:bool
class freestyle.ReadCompleteViewMapPixelF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > ReadCompleteViewMapPixelF0D

__init__(level)

Builds a ReadCompleteViewMapPixelF0D object.

Parameters:level (int) – The level of the pyramid from which the pixel must be read.
__call__(it)

Reads a pixel in one of the level of the complete viewmap.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:A pixel in one of the level of the complete viewmap.
Return type:float
class freestyle.ReadMapPixelF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > ReadMapPixelF0D

__init__(map_name, level)

Builds a ReadMapPixelF0D object.

Parameters:
  • map_name (str) – The name of the map to be read.
  • level (int) – The level of the pyramid from which the pixel must be read.
__call__(it)

Reads a pixel in a map.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:A pixel in a map.
Return type:float
class freestyle.ReadSteerableViewMapPixelF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat > ReadSteerableViewMapPixelF0D

__init__(orientation, level)

Builds a ReadSteerableViewMapPixelF0D object.

Parameters:
  • orientation (int) – The integer belonging to [0, 4] indicating the orientation (E, NE, N, NW) we are interested in.
  • level (int) – The level of the pyramid from which the pixel must be read.
__call__(it)

Reads a pixel in one of the level of one of the steerable viewmaps.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:A pixel in one of the level of one of the steerable viewmaps.
Return type:float
class freestyle.SShape

Class to define a feature shape. It is the gathering of feature elements from an identified input shape.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (SShape) – An SShape object.
add_edge(edge)

Adds an FEdge to the list of FEdges.

Parameters:edge (FEdge) – An FEdge object.
add_vertex(vertex)

Adds an SVertex to the list of SVertex of this Shape. The SShape attribute of the SVertex is also set to this SShape.

Parameters:vertex (SVertex) – An SVertex object.
compute_bbox()

Compute the bbox of the SShape.

bbox

The bounding box of the SShape.

Type :BBox
edges

The list of edges constituting this SShape.

Type :List of FEdge objects
id

The Id of this SShape.

Type :Id
name

The name of the SShape.

Type :str
vertices

The list of vertices constituting this SShape.

Type :List of SVertex objects
class freestyle.SVertex

Class hierarchy: Interface0D > SVertex

Class to define a vertex of the embedding.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (SVertex) – A SVertex object.
__init__(point_3d, id)

Builds a SVertex from 3D coordinates and an Id.

Parameters:
add_fedge(fedge)

Add an FEdge to the list of edges emanating from this SVertex.

Parameters:fedge (FEdge) – An FEdge.
add_normal(normal)

Adds a normal to the SVertex’s set of normals. If the same normal is already in the set, nothing changes.

Parameters:normal (mathutils.Vector, list or tuple of 3 real numbers) – A three-dimensional vector.
curvatures

Curvature information expressed in the form of a seven-element tuple (K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values representing the first (maximum) and second (minimum) principal curvatures at this SVertex, respectively; e1 and e2 are three-dimensional vectors representing the first and second principal directions, i.e. the directions of the normal plane where the curvature takes its maximum and minimum values, respectively; and Kr, er and dKr are the radial curvature, radial direction, and the derivative of the radial curvature at this SVertex, repectively.

Type :tuple
id

The Id of this SVertex.

Type :Id
normals

The normals for this Vertex as a list. In a sharp surface, an SVertex has exactly one normal. In a smooth surface, an SVertex can have any number of normals.

Type :list of mathutils.Vector objects
normals_size

The number of different normals for this SVertex.

Type :int
point_2d

The projected 3D coordinates of the SVertex.

Type :mathutils.Vector
point_3d

The 3D coordinates of the SVertex.

Type :mathutils.Vector
viewvertex

If this SVertex is also a ViewVertex, this property refers to the ViewVertex, and None otherwise. :type: ViewVertex

class freestyle.SVertexIterator

Class hierarchy: Iterator > SVertexIterator

Class representing an iterator over SVertex of a ViewEdge. An instance of an SVertexIterator can be obtained from a ViewEdge by calling verticesBegin() or verticesEnd().

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (SVertexIterator) – An SVertexIterator object.
__init__(vertex, begin, previous_edge, next_edge, t)

Build an SVertexIterator that starts iteration from an SVertex object v.

Parameters:
  • vertex (SVertex) – The SVertex from which the iterator starts iteration.
  • begin (SVertex) – The first SVertex of a ViewEdge.
  • previous_edge (FEdge) – The previous FEdge coming to vertex.
  • next_edge (FEdge) – The next FEdge going out from vertex.
  • t (float) – The curvilinear abscissa at vertex.
object

The SVertex object currently pointed by this iterator.

Type :SVertex
t

The curvilinear abscissa of the current point.

Type :float
u

The point parameter at the current point in the 1D element (0 <= u <= 1).

Type :float
class freestyle.SameShapeIdBP1D

Class hierarchy: BinaryPredicate1D > SameShapeIdBP1D

__call__(inter1, inter2)

Returns true if inter1 and inter2 belong to the same shape.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

True or false.

Return type:

bool

class freestyle.SamplingShader

Class hierarchy: StrokeShader > SamplingShader

[Geometry shader]

__init__(sampling)

Builds a SamplingShader object.

Parameters:sampling (float) – The sampling to use for the stroke resampling.
shade(stroke)

Resamples the stroke.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ShapeIdF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DId > ShapeIdF0D

__init__()

Builds a ShapeIdF0D object.

__call__(it)

Returns the Id of the Shape the Interface0D pointed by the Interface0DIterator belongs to. This evaluation can be ambiguous (in the case of a TVertex for example). This functor tries to remove this ambiguity using the context offered by the 1D element to which the Interface0DIterator belongs to. However, there still can be problematic cases, and the user willing to deal with this cases in a specific way should implement its own getShapeIdF0D functor.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The Id of the Shape the pointed Interface0D belongs to.
Return type:Id
class freestyle.ShapeUP1D

Class hierarchy: UnaryPredicate1D > ShapeUP1D

__init__(first, second=0)

Builds a ShapeUP1D object.

Parameters:
  • first (int) – The first Id component.
  • second (int) – The second Id component.
__call__(inter)

Returns true if the shape to which the Interface1D belongs to has the same Id as the one specified by the user.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True if Interface1D belongs to the shape of the user-specified Id.
Return type:bool
class freestyle.SmoothingShader

Class hierarchy: StrokeShader > SmoothingShader

[Geometry shader]

__init__(num_iterations=100, factor_point=0.1,
factor_curvature=0.0, factor_curvature_difference=0.2,
aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,
carricature_factor=1.0)

Builds a SmoothingShader object.

Parameters:
  • num_iterations (int) – The number of iterations.
  • factor_point (float) – 0.1
  • factor_curvature (float) – 0.0
  • factor_curvature_difference (float) – 0.2
  • aniso_point (float) – 0.0
  • aniso_normal (float) – 0.0
  • aniso_curvature (float) – 0.0
  • carricature_factor (float) – 1.0
shade(stroke)

Smoothes the stroke by moving the vertices to make the stroke smoother. Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we use is anisotropic to prevent the diffusion accross corners.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.SpatialNoiseShader

Class hierarchy: StrokeShader > SpatialNoiseShader

[Geometry shader]

__init__(amount, scale, num_octaves, smooth, pure_random)

Builds a SpatialNoiseShader object.

Parameters:
  • amount (float) – The amplitude of the noise.
  • scale (float) – The noise frequency.
  • num_octaves (int) – The number of octaves
  • smooth (bool) – True if you want the noise to be smooth.
  • pure_random (bool) – True if you don’t want any coherence.
shade(stroke)

Spatial Noise stroke shader. Moves the vertices to make the stroke more noisy.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.Stroke

Class hierarchy: Interface1D > Stroke

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.

Stroke()

Default constructor

Stroke(brother)

Copy constructor

compute_sampling(n)

Compute the sampling needed to get N 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:n (int) – The number of stroke vertices we eventually want in our Stroke.
Returns:The sampling that must be used in the Resample(float) method.
Return type:float
insert_vertex(vertex, next)

Inserts the StrokeVertex given as argument into the Stroke before the point specified by next. The length and curvilinear abscissa are updated consequently.

Parameters:
  • vertex (StrokeVertex) – The StrokeVertex to insert in the Stroke.
  • next (StrokeVertexIterator) – A StrokeVertexIterator pointing to the StrokeVertex before which vertex must be inserted.
remove_all_vertices()

Removes all vertices from the Stroke.

remove_vertex(vertex)

Removes the StrokeVertex given as argument from the Stroke. The length and curvilinear abscissa are updated consequently.

Parameters:vertex (StrokeVertex) – the StrokeVertex to remove from the Stroke.
resample(n)

Resamples the stroke so that it eventually has N points. That means it is going to add N-vertices_size, where vertices_size is the number of points we already have. If vertices_size >= N, no resampling is done.

Parameters:n (int) – The number of vertices we eventually want in our stroke.
resample(sampling)

Resamples the stroke with a given sampling. If the sampling is smaller than the actual sampling value, no resampling is done.

Parameters:sampling (float) – The new sampling value.
stroke_vertices_begin(t=0.0)

Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. O ne can specify a sampling value to resample the Stroke on the fly if needed.

Parameters:t (float) – The resampling value with which we want our Stroke to be resampled. If 0 is specified, no resampling is done.
Returns:A StrokeVertexIterator pointing on the first StrokeVertex.
Return type:StrokeVertexIterator
strokeVerticesEnd()

Returns a StrokeVertexIterator pointing after the last StrokeVertex of the Stroke.

Returns:A StrokeVertexIterator pointing after the last StrokeVertex.
Return type:StrokeVertexIterator
stroke_vertices_size()

Returns the number of StrokeVertex constituing the Stroke.

Returns:The number of stroke vertices.
Return type:int
update_length()

Updates the 2D length of the Stroke.

id

The Id of this Stroke.

Type :Id
length_2d

The 2D length of the Stroke.

Type :float
medium_type

The MediumType used for this Stroke.

Type :MediumType
texture_id

The ID of the texture used to simulate th marks system for this Stroke.

Type :int
tips

True if this Stroke uses a texture with tips, and false otherwise.

Type :bool
class freestyle.StrokeAttribute

Class to define a set of attributes associated with a StrokeVertex. The attribute set stores the color, alpha and thickness values for a Stroke Vertex.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (StrokeAttribute) – A StrokeAttribute object.
__init__(red, green, blue, alpha, thickness_right, thickness_left)

Build a stroke vertex attribute from a set of parameters.

Parameters:
  • red (float) – Red component of a stroke color.
  • green (float) – Green component of a stroke color.
  • blue (float) – Blue component of a stroke color.
  • alpha (float) – Alpha component of a stroke color.
  • thickness_right (float) – Stroke thickness on the right.
  • thickness_left (float) – Stroke thickness on the left.
__init__(attribute1, attribute2, t)

Interpolation constructor. Build a StrokeAttribute from two StrokeAttribute objects and an interpolation parameter.

Parameters:
  • attribute1 (StrokeAttribute) – The first StrokeAttribute object.
  • attribute2 (StrokeAttribute) – The second StrokeAttribute object.
  • t (float) – The interpolation parameter (0 <= t <= 1).
get_attribute_real(name)

Returns an attribute of float type.

Parameters:name (str) – The name of the attribute.
Returns:The attribute value.
Return type:float
get_attribute_vec2(name)

Returns an attribute of two-dimensional vector type.

Parameters:name (str) – The name of the attribute.
Returns:The attribute value.
Return type:mathutils.Vector
get_attribute_vec3(name)

Returns an attribute of three-dimensional vector type.

Parameters:name (str) – The name of the attribute.
Returns:The attribute value.
Return type:mathutils.Vector
has_attribute_real(name)

Checks whether the attribute name of float type is available.

Parameters:name (str) – The name of the attribute.
Returns:True if the attribute is availbale.
Return type:bool
has_attribute_vec2(name)

Checks whether the attribute name of two-dimensional vector type is available.

Parameters:name (str) – The name of the attribute.
Returns:True if the attribute is availbale.
Return type:bool
has_attribute_vec3(name)

Checks whether the attribute name of three-dimensional vector type is available.

Parameters:name (str) – The name of the attribute.
Returns:True if the attribute is availbale.
Return type:bool
set_attribute_real(name, value)

Adds a user-defined attribute of float type. If there is no attribute of the given name, it is added. Otherwise, the new value replaces the old one.

Parameters:
  • name (str) – The name of the attribute.
  • value (float) – The attribute value.
set_attribute_vec2(name, value)

Adds a user-defined attribute of two-dimensional vector type. If there is no attribute of the given name, it is added. Otherwise, the new value replaces the old one.

Parameters:
  • name (str) – The name of the attribute.
  • value (mathutils.Vector, list or tuple of 2 real numbers) – The attribute value.
set_attribute_vec3(name, value)

Adds a user-defined attribute of three-dimensional vector type. If there is no attribute of the given name, it is added. Otherwise, the new value replaces the old one.

Parameters:
  • name (str) – The name of the attribute.
  • value (mathutils.Vector, list or tuple of 3 real numbers) – The attribute value.
alpha

Alpha component of the stroke color.

Type :float
color

RGB components of the stroke color.

Type :mathutils.Color
thickness

Right and left components of the stroke thickness. The right (left) component is the thickness on the right (left) of the vertex when following the stroke.

Type :mathutils.Vector
visible

The visibility flag. True if the StrokeVertex is visible.

Type :bool
class freestyle.StrokeShader

Base class for stroke shaders. Any stroke shader must inherit from this class and overload the shade() method. A StrokeShader is designed to modify stroke attributes such as thickness, color, geometry, texture, blending mode, and so on. The basic way for this operation is to iterate over the stroke vertices of the Stroke and to modify the StrokeAttribute of each vertex. Here is a code example of such an iteration:

it = ioStroke.strokeVerticesBegin()
while not it.is_end:
    att = it.object.attribute
    ## perform here any attribute modification
    it.increment()
__init__()

Default constructor.

shade(stroke)

The shading method. Must be overloaded by inherited classes.

Parameters:stroke (Stroke) – A Stroke object.
name

The name of the stroke shader.

Type :str
class freestyle.StrokeTextureShader

Class hierarchy: StrokeShader > StrokeTextureShader

[Texture shader]

__init__(texture_file, medium_type=Stroke.OPAQUE_MEDIUM, tips=False)

Builds a StrokeTextureShader object.

Parameters:
  • texture_file (str) –
  • medium_type (MediumType) – The medium type and therefore, the blending mode that must be used for the rendering of this stroke.
  • tips (bool) – Tells whether the texture includes tips or not. If it is the case, the texture image must respect the following format.

The format of a texture image including tips:

 ___________
|           |
|     A     |
|___________|
|     |     |
|  B  |  C  |
|_____|_____|
  • A : The stroke’s corpus texture.
  • B : The stroke’s left extremity texture.
  • C : The stroke’s right extremity texture.
shade(stroke)

Assigns a texture and a blending mode to the stroke in order to simulate its marks system.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.StrokeVertex

Class hierarchy: Interface0D > CurvePoint > StrokeVertex

Class to define a stroke vertex.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (StrokeVertex) – A StrokeVertex object.
__init__(first_vertex, second_vertex, t3d)

Build a stroke vertex from 2 stroke vertices and an interpolation parameter.

Parameters:
  • first_vertex (StrokeVertex) – The first StrokeVertex.
  • second_vertex (StrokeVertex) – The second StrokeVertex.
  • t3d (float) – An interpolation parameter.
__init__(point)

Build a stroke vertex from a CurvePoint

Parameters:point (CurvePoint) – A CurvePoint object.
__init__(svertex)

Build a stroke vertex from a SVertex

Parameters:svertex (SVertex) – An SVertex object.
__init__(svertex, attribute)

Build a stroke vertex from an SVertex and a StrokeAttribute object.

Parameters:
attribute

StrokeAttribute for this StrokeVertex.

Type :StrokeAttribute
curvilinear_abscissa

Curvilinear abscissa of this StrokeVertex in the Stroke.

Type :float
point

2D point coordinates.

Type :mathutils.Vector
stroke_length

Stroke length (it is only a value retained by the StrokeVertex, and it won’t change the real stroke length).

Type :float
u

Curvilinear abscissa of this StrokeVertex in the Stroke.

Type :float
class freestyle.StrokeVertexIterator

Class hierarchy: Iterator > StrokeVertexIterator

Class defining an iterator designed to iterate over the StrokeVertex of a Stroke. An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling strokeVerticesBegin() or strokeVerticesEnd(). It is iterating over the same vertices as an Interface0DIterator. The difference resides in the object access. Indeed, an Interface0DIterator allows only an access to an Interface0D whereas we could need to access the specialized StrokeVertex type. In this case, one should use a StrokeVertexIterator. The castToInterface0DIterator() method is useful to get an Interface0DIterator from a StrokeVertexIterator in order to call any functions of the UnaryFunction0D type.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (StrokeVertexIterator) – A StrokeVertexIterator object.
object

The StrokeVertex object currently pointed by this iterator.

Type :StrokeVertex
t

The curvilinear abscissa of the current point.

Type :float
u

The point parameter at the current point in the stroke (0 <= u <= 1).

Type :float
class freestyle.TVertex

Class hierarchy: Interface0D > ViewVertex > TVertex

Class to define a T vertex, i.e. an intersection between two edges. It points towards two SVertex and four ViewEdges. Among the ViewEdges, two are front and the other two are back. Basically a front edge hides part of a back edge. So, among the back edges, one is of invisibility N and the other of invisibility N+1.

__init__()

Default constructor.

get_mate(viewedge)

Returns the mate edge of the ViewEdge given as argument. If the ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is frontEdgeB, frontEdgeA is returned. Same for back edges.

Parameters:viewedge (ViewEdge) – A ViewEdge object.
Returns:The mate edge of the given ViewEdge.
Return type:ViewEdge
get_svertex(fedge)

Returns the SVertex (among the 2) belonging to the given FEdge.

Parameters:fedge (FEdge) – An FEdge object.
Returns:The SVertex belonging to the given FEdge.
Return type:SVertex
back_svertex

The SVertex that is further away from the viewpoint.

Type :SVertex
front_svertex

The SVertex that is closer to the viewpoint.

Type :SVertex
id

The Id of this TVertex.

Type :Id
class freestyle.TextureAssignerShader

Class hierarchy: StrokeShader > TextureAssignerShader

[Texture shader]

__init__(preset)

Builds a TextureAssignerShader object.

Parameters:preset (int) – The preset number to use.
shade(stroke)

Assigns a texture to the stroke in order to simulate its marks system. This shader takes as input an integer value telling which texture and blending mode to use among a set of predefined textures. Here are the different presets:

  • 0: /brushes/charcoalAlpha.bmp, Stroke.HUMID_MEDIUM
  • 1: /brushes/washbrushAlpha.bmp, Stroke.HUMID_MEDIUM
  • 2: /brushes/oil.bmp, Stroke.HUMID_MEDIUM
  • 3: /brushes/oilnoblend.bmp, Stroke.HUMID_MEDIUM
  • 4: /brushes/charcoalAlpha.bmp, Stroke.DRY_MEDIUM
  • 5: /brushes/washbrushAlpha.bmp, Stroke.DRY_MEDIUM
  • 6: /brushes/opaqueDryBrushAlpha.bmp, Stroke.OPAQUE_MEDIUM
  • 7: /brushes/opaqueBrushAlpha.bmp, Stroke.OPAQUE_MEDIUM

Any other value will lead to the following preset:

  • Default: /brushes/smoothAlpha.bmp, Stroke.OPAQUE_MEDIUM
Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ThicknessNoiseShader

Class hierarchy: StrokeShader > ThicknessNoiseShader

[Thickness shader]

__init__(amplitude, period)

Builds a ThicknessNoiseShader object.

Parameters:
  • amplitude (float) – The amplitude of the noise signal.
  • period (float) – The period of the noise signal.
shade(stroke)

Adds some noise to the stroke thickness.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.ThicknessVariationPatternShader

Class hierarchy: StrokeShader > ThicknessVariationPatternShader

[Thickness shader]

__init__(pattern_name, thickness_min=1.0, thickness_max=5.0, stretch=True)

Builds a ThicknessVariationPatternShader object.

Parameters:
  • pattern_name (str) – The texture file name.
  • thickness_min (float) – The minimum thickness we don’t want to exceed.
  • thickness_max (float) – The maximum thickness we don’t want to exceed.
  • stretch (bool) – Tells whether the pattern texture must be stretched or repeated to fit the stroke.
shade(stroke)

Applies a pattern (texture) to vary thickness. The new thicknesses are the result of the multiplication of the pattern and the original thickness.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.TimeStampF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DVoid > TimeStampF1D

__init__()

Builds a TimeStampF1D object.

__call__(inter)

Returns the time stamp of the Interface1D.

Parameters:inter (Interface1D) – An Interface1D object.
class freestyle.TipRemoverShader

Class hierarchy: StrokeShader > TipRemoverShader

[Geometry shader]

__init__(tip_length)

Builds a TipRemoverShader object.

Parameters:tip_length (float) – The length of the piece of stroke we want to remove at each extremity.
shade(stroke)

Removes the stroke’s extremities.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.TrueBP1D

Class hierarchy: BinaryPredicate1D > TrueBP1D

__call__(inter1, inter2)

Always returns true.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

True.

Return type:

bool

class freestyle.TrueUP0D

Class hierarchy: UnaryPredicate0D > TrueUP0D

__call__(it)

Always returns true.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:True.
Return type:bool
class freestyle.TrueUP1D

Class hierarchy: UnaryPredicate1D > TrueUP1D

__call__(inter)

Always returns true.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:True.
Return type:bool
class freestyle.UnaryFunction0D

Base class for Unary Functions (functors) working on Interface0DIterator. A unary function will be used by invoking __call__() on an Interface0DIterator. In Python, several different subclasses of UnaryFunction0D are used depending on the types of functors’ return values. For example, you would inherit from a UnaryFunction0DDouble if you wish to define a function that returns a double value. Available UnaryFunction0D subclasses are:

name

The name of the unary 0D function.

Type :str
class freestyle.UnaryFunction0DDouble

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble

Base class for unary functions (functors) that work on Interface0DIterator and return a float value.

__init__()

Default constructor.

class freestyle.UnaryFunction0DEdgeNature

Class hierarchy: UnaryFunction0D > UnaryFunction0DEdgeNature

Base class for unary functions (functors) that work on Interface0DIterator and return a Nature object.

__init__()

Default constructor.

class freestyle.UnaryFunction0DFloat

Class hierarchy: UnaryFunction0D > UnaryFunction0DFloat

Base class for unary functions (functors) that work on Interface0DIterator and return a float value.

__init__()

Default constructor.

class freestyle.UnaryFunction0DId

Class hierarchy: UnaryFunction0D > UnaryFunction0DId

Base class for unary functions (functors) that work on Interface0DIterator and return an Id object.

__init__()

Default constructor.

class freestyle.UnaryFunction0DMaterial

Class hierarchy: UnaryFunction0D > UnaryFunction0DMaterial

Base class for unary functions (functors) that work on Interface0DIterator and return a Material object.

__init__()

Default constructor.

class freestyle.UnaryFunction0DUnsigned

Class hierarchy: UnaryFunction0D > UnaryFunction0DUnsigned

Base class for unary functions (functors) that work on Interface0DIterator and return an int value.

__init__()

Default constructor.

class freestyle.UnaryFunction0DVec2f

Class hierarchy: UnaryFunction0D > UnaryFunction0DVec2f

Base class for unary functions (functors) that work on Interface0DIterator and return a 2D vector.

__init__()

Default constructor.

class freestyle.UnaryFunction0DVec3f

Class hierarchy: UnaryFunction0D > UnaryFunction0DVec3f

Base class for unary functions (functors) that work on Interface0DIterator and return a 3D vector.

__init__()

Default constructor.

class freestyle.UnaryFunction0DVectorViewShape

Class hierarchy: UnaryFunction0D > UnaryFunction0DVectorViewShape

Base class for unary functions (functors) that work on Interface0DIterator and return a list of ViewShape objects.

__init__()

Default constructor.

class freestyle.UnaryFunction0DViewShape

Class hierarchy: UnaryFunction0D > UnaryFunction0DViewShape

Base class for unary functions (functors) that work on Interface0DIterator and return a ViewShape object.

__init__()

Default constructor.

class freestyle.UnaryFunction1D

Base class for Unary Functions (functors) working on Interface1D. A unary function will be used by invoking __call__() on an Interface1D. In Python, several different subclasses of UnaryFunction1D are used depending on the types of functors’ return values. For example, you would inherit from a UnaryFunction1DDouble if you wish to define a function that returns a double value. Available UnaryFunction1D subclasses are:

name

The name of the unary 1D function.

Type :str
class freestyle.UnaryFunction1DDouble

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble

Base class for unary functions (functors) that work on Interface1D and return a float value.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DEdgeNature

Class hierarchy: UnaryFunction1D > UnaryFunction1DEdgeNature

Base class for unary functions (functors) that work on Interface1D and return a Nature object.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DFloat

Class hierarchy: UnaryFunction1D > UnaryFunction1DFloat

Base class for unary functions (functors) that work on Interface1D and return a float value.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DUnsigned

Class hierarchy: UnaryFunction1D > UnaryFunction1DUnsigned

Base class for unary functions (functors) that work on Interface1D and return an int value.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DVec2f

Class hierarchy: UnaryFunction1D > UnaryFunction1DVec2f

Base class for unary functions (functors) that work on Interface1D and return a 2D vector.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DVec3f

Class hierarchy: UnaryFunction1D > UnaryFunction1DVec3f

Base class for unary functions (functors) that work on Interface1D and return a 3D vector.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DVectorViewShape

Class hierarchy: UnaryFunction1D > UnaryFunction1DVectorViewShape

Base class for unary functions (functors) that work on Interface1D and return a list of ViewShape objects.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryFunction1DVoid

Class hierarchy: UnaryFunction1D > UnaryFunction1DVoid

Base class for unary functions (functors) working on Interface1D.

__init__()

Default constructor.

__init__(integration_type)

Builds a unary 1D function using the integration method given as argument.

Parameters:integration_type (IntegrationType) – An integration method.
integration_type

The integration method.

Type :IntegrationType
class freestyle.UnaryPredicate0D

Base class for unary predicates that work on Interface0DIterator. A UnaryPredicate0D is a functor that evaluates a condition on an Interface0DIterator and returns true or false depending on whether this condition is satisfied or not. The UnaryPredicate0D is used by invoking its __call__() method. Any inherited class must overload the __call__() method.

__init__()

Default constructor.

__call__(it)

Must be overload by inherited classes.

Parameters:it (Interface0DIterator) – The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the predicate.
Returns:True if the condition is satisfied, false otherwise.
Return type:bool
name

The name of the unary 0D predicate.

Type :str
class freestyle.UnaryPredicate1D

Base class for unary predicates that work on Interface1D. A UnaryPredicate1D is a functor that evaluates a condition on a Interface1D and returns true or false depending on whether this condition is satisfied or not. The UnaryPredicate1D is used by invoking its __call__() method. Any inherited class must overload the __call__() method.

__init__()

Default constructor.

__call__(inter)

Must be overload by inherited classes.

Parameters:inter (Interface1D) – The Interface1D on which we wish to evaluate the predicate.
Returns:True if the condition is satisfied, false otherwise.
Return type:bool
name

The name of the unary 1D predicate.

Type :str
class freestyle.VertexOrientation2DF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DVec2f > VertexOrientation2DF0D

__init__()

Builds a VertexOrientation2DF0D object.

__call__(it)

Returns a two-dimensional vector giving the 2D oriented tangent to the 1D element to which the Interface0D pointed by the Interface0DIterator belongs. The 2D oriented tangent is evaluated at the pointed Interface0D.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The 2D oriented tangent to the 1D element evaluated at the pointed Interface0D.
Return type:mathutils.Vector
class freestyle.VertexOrientation3DF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DVec3f > VertexOrientation3DF0D

__init__()

Builds a VertexOrientation3DF0D object.

__call__(it)

Returns a three-dimensional vector giving the 3D oriented tangent to the 1D element to which the Interface0D pointed by the Interface0DIterator belongs. The 3D oriented tangent is evaluated at the pointed Interface0D.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The 3D oriented tangent to the 1D element evaluated at the pointed Interface0D.
Return type:mathutils.Vector
class freestyle.ViewEdge

Class hierarchy: Interface1D > ViewEdge

Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connnects two ViewVertex objects. It is made by connecting a set of FEdges.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (ViewEdge) – A ViewEdge object.
update_fedges()

Sets Viewedge to this for all embedded fedges.

chaining_time_stamp

The time stamp of this ViewEdge.

Type :int
first_fedge

The first FEdge that constitutes this ViewEdge.

Type :FEdge
first_viewvertex

The first ViewVertex.

Type :ViewVertex
id

The Id of this ViewEdge.

Type :Id
is_closed

True if this ViewEdge forms a closed loop.

Type :bool
last_fedge

The last FEdge that constitutes this ViewEdge.

Type :FEdge
last_viewvertex

The second ViewVertex.

Type :ViewVertex
nature

The nature of this ViewEdge.

Type :Nature
occludee

The shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no object is occluded, this property is set to None.

Type :ViewShape
qi

The quantitative invisibility.

Type :int
viewshape

The ViewShape to which this ViewEdge belongs to.

Type :ViewShape
class freestyle.ViewEdgeIterator

Class hierarchy: Iterator > ViewEdgeIterator

Base class for iterators over ViewEdges of the ViewMap Graph. Basically the increment() operator of this class should be able to take the decision of “where” (on which ViewEdge) to go when pointing on a given ViewEdge.

__init__(begin=None, orientation=True)

Builds a ViewEdgeIterator from a starting ViewEdge and its orientation.

Parameters:
  • begin (ViewEdge or None) – The ViewEdge from where to start the iteration.
  • orientation (bool) – If true, we’ll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin. If false, we’ll search over the ViewEdges surrounding the ending ViewVertex of begin.
__init__(brother)

Copy constructor.

Parameters:brother (ViewEdgeIterator) – A ViewEdgeIterator object.
change_orientation()

Changes the current orientation.

begin

The first ViewEdge used for the iteration.

Type :ViewEdge
current_edge

The ViewEdge object currently pointed by this iterator.

Type :ViewEdge
object

The ViewEdge object currently pointed by this iterator.

Type :ViewEdge
orientation

The orientation of the pointed ViewEdge in the iteration. If true, the iterator looks for the next ViewEdge among those ViewEdges that surround the ending ViewVertex of the “begin” ViewEdge. If false, the iterator searches over the ViewEdges surrounding the ending ViewVertex of the “begin” ViewEdge.

Type :bool
class freestyle.ViewMap

Class defining the ViewMap.

__init__()

Default constructor.

get_closest_fedge(x, y)

Gets the FEdge nearest to the 2D point specified as arguments.

Parameters:
  • x (float) – X coordinate of a 2D point.
  • y (float) – Y coordinate of a 2D point.
Returns:

The FEdge nearest to the specified 2D point.

Return type:

FEdge

get_closest_viewedge(x, y)

Gets the ViewEdge nearest to the 2D point specified as arguments.

Parameters:
  • x (float) – X coordinate of a 2D point.
  • y (float) – Y coordinate of a 2D point.
Returns:

The ViewEdge nearest to the specified 2D point.

Return type:

ViewEdge

scene_bbox

The 3D bounding box of the scene.

Type :BBox
class freestyle.ViewMapGradientNormBP1D

Class hierarchy: BinaryPredicate1D > ViewMapGradientNormBP1D

__init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)

Builds a ViewMapGradientNormBP1D object.

Parameters:
  • level (int) – The level of the pyramid from which the pixel must be read.
  • integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
  • sampling (float) – The resolution used to sample the chain: GetViewMapGradientNormF0D is evaluated at each sample point and the result is obtained by combining the resulting values into a single one, following the method specified by integration_type.
__call__(inter1, inter2)

Returns true if the evaluation of the Gradient norm Function is higher for inter1 than for inter2.

Parameters:
  • inter1 (Interface1D) – The first Interface1D object.
  • inter2 (Interface1D) – The second Interface1D object.
Returns:

True or false.

Return type:

bool

class freestyle.ViewShape

Class gathering the elements of the ViewMap (i.e., ViewVertex and ViewEdge) that are issued from the same input shape.

__init__()

Default constructor.

__init__(brother)

Copy constructor.

Parameters:brother (ViewShape) – A ViewShape object.
__init__(sshape)

Builds a ViewShape from an SShape.

Parameters:sshape (SShape) – An SShape object.
add_edge(edge)

Adds a ViewEdge to the list of ViewEdge objects.

Parameters:edge (ViewEdge) – A ViewEdge object.
add_vertex(vertex)

Adds a ViewVertex to the list of the ViewVertex objects.

Parameters:vertex (ViewVertex) – A ViewVertex object.
edges

The list of ViewEdge objects contained in this ViewShape.

Type :List of ViewEdge objects
id

The Id of this ViewShape.

Type :Id
name

The name of the ViewShape.

Type :str
sshape

The SShape on top of which this ViewShape is built.

Type :SShape
vertices

The list of ViewVertex objects contained in this ViewShape.

Type :List of ViewVertex objects
class freestyle.ViewVertex

Class hierarchy: Interface0D > ViewVertex

Class to define a view vertex. A view vertex is a feature vertex corresponding to a point of the image graph, where the characteristics of an edge (e.g., nature and visibility) might change. A ViewVertex can be of two kinds: A TVertex when it corresponds to the intersection between two ViewEdges or a NonTVertex when it corresponds to a vertex of the initial input mesh (it is the case for vertices such as corners for example). Thus, this class can be specialized into two classes, the TVertex class and the NonTVertex class.

edges_begin()

Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing).

Returns:An orientedViewEdgeIterator pointing to the first ViewEdge.
Return type:orientedViewEdgeIterator
edges_end()

Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge.

Returns:An orientedViewEdgeIterator pointing after the last ViewEdge.
Return type:orientedViewEdgeIterator
edges_iterator(edge)

Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument.

Parameters:edge (ViewEdge) – A ViewEdge object.
Returns:An orientedViewEdgeIterator pointing to the given ViewEdge.
Return type:orientedViewEdgeIterator
nature

The nature of this ViewVertex.

Type :Nature
class freestyle.WithinImageBoundaryUP1D

Class hierarchy: UnaryPredicate1D > WithinImageBoundaryUP1D

__init__(xmin, ymin, xmax, ymax)

Builds an WithinImageBoundaryUP1D object.

Parameters:
  • xmin (float) – X lower bound of the image boundary.
  • ymin (float) – Y lower bound of the image boundary.
  • xmax (float) – X upper bound of the image boundary.
  • ymax (float) – Y upper bound of the image boundary.
__call__(inter)

Returns true if the Interface1D intersects with image boundary.

class freestyle.ZDiscontinuityF0D

Class hierarchy: UnaryFunction0D > UnaryFunction0DDouble > ZDiscontinuityF0D

__init__()

Builds a ZDiscontinuityF0D object.

__call__(it)

Returns a real value giving the distance between the Interface0D pointed by the Interface0DIterator and the shape that lies behind (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no oject is occluded by the shape to which the Interface0D belongs to, 1 is returned.

Parameters:it (Interface0DIterator) – An Interface0DIterator object.
Returns:The normalized distance between the pointed Interface0D and the occludee.
Return type:float
class freestyle.ZDiscontinuityF1D

Class hierarchy: UnaryFunction1D > UnaryFunction1DDouble > ZDiscontinuityF1D

__init__(integration_type=IntegrationType.MEAN)

Builds a ZDiscontinuityF1D object.

Parameters:integration_type (IntegrationType) – The integration method used to compute a single value from a set of values.
__call__(inter)

Returns a real value giving the distance between an Interface1D and the shape that lies behind (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no oject is occluded by the shape to which the Interface1D belongs to, 1 is returned.

Parameters:inter (Interface1D) – An Interface1D object.
Returns:The normalized distance between the Interface1D and the occludee.
Return type:float
class freestyle.fstreamShader

Class hierarchy: StrokeShader > fstreamShader

[Output shader]

__init__(filename)

Builds a fstreamShader object.

Parameters:filename (str) – The output file name.
shade(stroke)

Streams the Stroke in a file.

Parameters:stroke (Stroke) – A Stroke object.
class freestyle.orientedViewEdgeIterator

Class hierarchy: Iterator > orientedViewEdgeIterator

Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator allows a CCW iteration (in the image plane). An instance of an orientedViewEdgeIterator can only be obtained from a ViewVertex by calling edgesBegin() or edgesEnd().

__init__()

Default constructor.

__init__(iBrother)

Copy constructor.

Parameters:iBrother (orientedViewEdgeIterator) – An orientedViewEdgeIterator object.
object

The oriented ViewEdge (i.e., a tuple of the pointed ViewEdge and a boolean value) currently pointed by this iterator. If the boolean value is true, the ViewEdge is incoming.

Type :(directedViewEdge, bool)
class freestyle.streamShader

Class hierarchy: StrokeShader > streamShader

[Output shader]

__init__()

Builds a streamShader object.

shade(stroke)

Streams the Stroke into stdout.

Parameters:stroke (Stroke) – A Stroke object.

Previous topic

Noise Utilities (mathutils.noise)

Next topic

OpenGL Wrapper (bgl)