user: What is Freestyle Types (freestyle.types) and how is it used in Blender Python scripting?

assistant: # Freestyle Types (freestyle.types)

This module contains core classes of the Freestyle Python API,
including data types of view map components (0D and 1D elements), base
classes for user-defined line stylization rules (predicates,
functions, chaining iterators, and stroke shaders), and operators.

Class hierarchy:

- `BBox`
- `BinaryPredicate0D`
- `BinaryPredicate1D`
- `Id`
- `Interface0D`

  - `CurvePoint`

    - `StrokeVertex`
  - `SVertex`
  - `ViewVertex`

    - `NonTVertex`
    - `TVertex`
- `Interface1D`

  - `Curve`

    - `Chain`
  - `FEdge`

    - `FEdgeSharp`
    - `FEdgeSmooth`
  - `Stroke`
  - `ViewEdge`
- `Iterator`

  - `AdjacencyIterator`
  - `CurvePointIterator`
  - `Interface0DIterator`
  - `SVertexIterator`
  - `StrokeVertexIterator`
  - `ViewEdgeIterator`

    - `ChainingIterator`
  - `orientedViewEdgeIterator`
- `Material`
- `Noise`
- `Operators`
- `SShape`
- `StrokeAttribute`
- `StrokeShader`
- `UnaryFunction0D`

  - `UnaryFunction0DDouble`
  - `UnaryFunction0DEdgeNature`
  - `UnaryFunction0DFloat`
  - `UnaryFunction0DId`
  - `UnaryFunction0DMaterial`
  - `UnaryFunction0DUnsigned`
  - `UnaryFunction0DVec2f`
  - `UnaryFunction0DVec3f`
  - `UnaryFunction0DVectorViewShape`
  - `UnaryFunction0DViewShape`
- `UnaryFunction1D`

  - `UnaryFunction1DDouble`
  - `UnaryFunction1DEdgeNature`
  - `UnaryFunction1DFloat`
  - `UnaryFunction1DUnsigned`
  - `UnaryFunction1DVec2f`
  - `UnaryFunction1DVec3f`
  - `UnaryFunction1DVectorViewShape`
  - `UnaryFunction1DVoid`
- `UnaryPredicate0D`
- `UnaryPredicate1D`
- `ViewMap`
- `ViewShape`
- `IntegrationType`
- `MediumType`
- `Nature`

*class* freestyle.types.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__()

    __init__(*brother*)

    __init__(*vertex*, *restrict_to_selection=True*, *restrict_to_unvisited=True*)
    :   Builds an `AdjacencyIterator` using the default constructor,
        copy constructor or the overloaded constructor.

        Parameters:
        :   - **brother** (`AdjacencyIterator`) – An AdjacencyIterator object.
            - **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 to by this iterator.

        Type:
        :   `ViewEdge`

*class* freestyle.types.BBox
:   Class for representing a bounding box.

    __init__()
    :   Default constructor.

*class* freestyle.types.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.types.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.types.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__()

    __init__(*brother*)

    __init__(*id*)
    :   Builds a `Chain` using the default constructor,
        copy constructor or from an `Id`.

        Parameters:
        :   - **brother** (`Chain`) – A Chain object.
            - **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.types.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*)

    __init__(*brother*)
    :   Builds a Chaining Iterator from the first ViewEdge used for
        iteration and its orientation or by using the copy constructor.

        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` | 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.
            - **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` | 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.types.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__()

    __init__(*brother*)

    __init__(*id*)
    :   Builds a `FrsCurve` using a default constructor,
        copy constructor or from an `Id`.

        Parameters:
        :   - **brother** (`Curve`) – A Curve object.
            - **id** (`Id`) – An Id object.

    push_vertex_back(*vertex*)
    :   Adds a single vertex at the end of the Curve.

        Parameters:
        :   **vertex** (`SVertex` | `CurvePoint`) – A vertex object.

    push_vertex_front(*vertex*)
    :   Adds a single vertex at the front of the Curve.

        Parameters:
        :   **vertex** (`SVertex` | `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 constituting the Curve.

        Type:
        :   int

*class* freestyle.types.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__()

    __init__(*brother*)

    __init__(*first_vertex*, *second_vertex*, *t2d*)

    __init__(*first_point*, *second_point*, *t2d*)
    :   Builds a CurvePoint using the default constructor, copy constructor,
        or one of the overloaded constructors. The over loaded constructors
        can either take two `SVertex` or two `CurvePoint`
        objects and an interpolation parameter

        Parameters:
        :   - **brother** (`CurvePoint`) – A CurvePoint object.
            - **first_vertex** (`SVertex`) – The first SVertex.
            - **second_vertex** (`SVertex`) – The second SVertex.
            - **first_point** (`CurvePoint`) – The first CurvePoint.
            - **second_point** (`CurvePoint`) – The second CurvePoint.
            - **t2d** (*float*) – A 2D interpolation parameter used to linearly interpolate
              first_vertex and second_vertex or first_point and second_point.

    fedge
    :   Gets the FEdge for the two SVertices that given CurvePoints consists out of.
        A shortcut for CurvePoint.first_svertex.get_fedge(CurvePoint.second_svertex).

        Type:
        :   `FEdge`

    first_svertex
    :   The first SVertex upon which the CurvePoint is built.

        Type:
        :   `SVertex`

    second_svertex
    :   The second SVertex upon which the CurvePoint is built.

        Type:
        :   `SVertex`

    t2d
    :   The 2D interpolation parameter.

        Type:
        :   float

*class* freestyle.types.CurvePointIterator
:   Class hierarchy: `Iterator` > `CurvePointIterator`

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

    __init__()

    __init__(*brother*)

    __init__(*step=0.0*)
    :   Builds a CurvePointIterator object using either the default constructor,
        copy constructor, or the overloaded constructor.

        Parameters:
        :   - **brother** (`CurvePointIterator`) – A CurvePointIterator object.
            - **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.types.FEdge
:   Class hierarchy: `Interface1D` > [`FEdge`](#freestyle.types.freestyle.types.FEdge.FEdge "freestyle.types.freestyle.types.FEdge.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 across 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()

    FEdge(*brother*)
    :   Builds an [`FEdge`](#freestyle.types.freestyle.types.FEdge.FEdge "freestyle.types.freestyle.types.FEdge.FEdge") using the default constructor,
        copy constructor, or between two `SVertex` objects.

        Parameters:
        :   - **brother** ([`FEdge`](#freestyle.types.freestyle.types.FEdge.FEdge "freestyle.types.freestyle.types.FEdge.FEdge")) – An FEdge object.
            - **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`](#freestyle.types.freestyle.types.FEdge.FEdge "freestyle.types.freestyle.types.FEdge.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`](#freestyle.types.freestyle.types.FEdge.FEdge "freestyle.types.freestyle.types.FEdge.FEdge")

    second_svertex
    :   The second SVertex constituting this FEdge.

        Type:
        :   `SVertex`

    viewedge
    :   The ViewEdge to which this FEdge belongs to.

        Type:
        :   `ViewEdge`

*class* freestyle.types.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 bordered 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__()

    __init__(*brother*)

    __init__(*first_vertex*, *second_vertex*)
    :   Builds an `FEdgeSharp` using the default constructor,
        copy constructor, or between two `SVertex` objects.

        Parameters:
        :   - **brother** (`FEdgeSharp`) – An FEdgeSharp object.
            - **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`](mathutils.html#mathutils.Vector "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`](mathutils.html#mathutils.Vector "mathutils.Vector")

*class* freestyle.types.FEdgeSmooth
:   Class hierarchy: `Interface1D` > `FEdge` > `FEdgeS