user: Provide the full official documentation entry for Freestyle.Types, preserving all code examples.

assistant: 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.types. 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. Undocumented, consider contributing . 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 | tuple[float, float] | list[float]) – 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 | tuple[float, float, float] | list[float]) – 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 | tuple[float, float] | list[float]) – 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 | tuple[float, float, float] | list[float]) – Three-dimensional sample point. freq ( float ) – Noise frequency. amp ( float ) – Amplitude. oct ( int ) – Number of octaves. Returns : A noise value. Return type : float Undocumented, consider contributing . class freestyle.types. 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__ ( ) ¶ __init__ ( svertex ) Builds a NonTVertex using the default constructor or a SVertex . Parameters : svertex ( SVertex ) – An SVertex object. svertex ¶ The SVertex on top of which this NonTVertex is built. Type : SVertex class freestyle.types. 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 ) ¶ static bidirectional_chain ( it ) 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. This parameter is optional, you make not want to pass a stopping criterion when the stopping criterion is already contained in the iterator definition. static chain ( it , pred , 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. 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). If this argument is not given, the time stamp is automatically managed. 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[ StrokeShader ]) – 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 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 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 Returns : The ViewEdge object. Return type : ViewEdge static recursive_split ( func , pred_1d , sampling = 0.0 ) ¶ 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 recursivity level is controlled through a predicate 1D that expresses a stopping condition on the chain that is about to be processed. The user can also 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. 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 ( UnaryPredicate1D ) – 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 reset ( delete_strokes = True ) ¶ Resets the line stylization process to the initial state. The results of stroke creation are accumulated if delete_strokes is set to False. Parameters : delete_strokes ( bool ) – Delete the strokes that are currently stored. 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 ) ¶ 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. 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. Tip By specifying a starting and stopping predicate allows the chains to overlap rather than chains partitioning. Parameters : starting_pred ( UnaryPredicate0D ) – The predicate on a point that expresses the starting condition. Each time this condition is verified, a new chain begins stopping_pred ( UnaryPredicate0D ) – The predicate on a point that expresses the stopping condition. The chain ends as soon as this predicate is verified. pred ( UnaryPredicate0D ) – The predicate on a point that expresses the splitting condition. Each time the condition is verified, the chain is split into two chains. The resulting set of chains is a partition of the initial chain 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 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.types. SShape ¶ Class to define a feature shape. It is the gathering of feature elements from an identified input shape. __init__ ( ) ¶ __init__ ( brother ) Creates a SShape class using either a default constructor or 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 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 class freestyle.types. SVertex ¶ Class hierarchy: Interface0D > SVertex Class to define a vertex of the embedding. __init__ ( ) ¶ __init__ ( brother ) __init__ ( point_3d , id ) Builds a SVertex using the default constructor, copy constructor or the overloaded constructor which builds a SVertex from 3D coordinates and an Id. Parameters : brother ( SVertex ) – A SVertex object. point_3d ( mathutils.Vector ) – A three-dimensional vector. id ( Id ) – An Id object. 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 | tuple[float, float, float] | list[float]) – 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, respectively. 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 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.types. 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__ ( ) ¶ __init__ ( brother ) __init__ ( vertex , begin , previous_edge , next_edge , t ) Build an SVertexIterator using either the default constructor, copy constructor, or the overloaded constructor that starts iteration from an SVertex object vertex. Parameters : brother ( SVertexIterator ) – An SVertexIterator object. 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 Type : float class freestyle.types. 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 ( ) ¶ Stroke ( brother ) Creates a Stroke using the default constructor or 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 ) ¶ resample ( sampling ) Resamples the stroke so using one of two methods with the goal of creating a stroke with fewer points and the same shape. Parameters : n ( int ) – 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. sampling ( float ) – Resamples the stroke with a given sampling value. If the sampling is smaller than the actual sampling value, no resampling is done. stroke_vertices_begin ( t = 0.0 ) ¶ Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specify a sampling value to re-sample 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 stroke_vertices_end ( ) ¶ 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 constituting 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.types. 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__ ( ) ¶ __init__ ( brother )