user: How do I use Freestyle Functions (freestyle.functions) in Blender? Include parameters, examples, warnings and best practices.

assistant: # Freestyle Functions (freestyle.functions)

This module contains functions operating on vertices (0D elements) and
polylines (1D elements). The module is also intended to be a
collection of examples for function definition in Python.

User-defined functions inherit one of the following base classes,
depending on the object type (0D or 1D) to operate on and the return
value type:

- `freestyle.types.UnaryFunction0DDouble`
- `freestyle.types.UnaryFunction0DEdgeNature`
- `freestyle.types.UnaryFunction0DFloat`
- `freestyle.types.UnaryFunction0DId`
- `freestyle.types.UnaryFunction0DMaterial`
- `freestyle.types.UnaryFunction0DUnsigned`
- `freestyle.types.UnaryFunction0DVec2f`
- `freestyle.types.UnaryFunction0DVec3f`
- `freestyle.types.UnaryFunction0DVectorViewShape`
- `freestyle.types.UnaryFunction0DViewShape`
- `freestyle.types.UnaryFunction1DDouble`
- `freestyle.types.UnaryFunction1DEdgeNature`
- `freestyle.types.UnaryFunction1DFloat`
- `freestyle.types.UnaryFunction1DUnsigned`
- `freestyle.types.UnaryFunction1DVec2f`
- `freestyle.types.UnaryFunction1DVec3f`
- `freestyle.types.UnaryFunction1DVectorViewShape`
- `freestyle.types.UnaryFunction1DVoid`

*class* freestyle.functions.ChainingTimeStampF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DVoid` > `ChainingTimeStampF1D`

    __init__()
    :   Builds a ChainingTimeStampF1D object.

    __call__(*inter*)
    :   Sets the chaining time stamp of the Interface1D.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

*class* freestyle.functions.Curvature2DAngleF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.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 `freestyle.types.Interface0D` pointed by
        the Interface0DIterator belongs. The 2D curvature is evaluated at the
        Interface0D.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The 2D curvature of the 1D element evaluated at the
            pointed Interface0D.

        Return type:
        :   float

*class* freestyle.functions.Curvature2DAngleF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DDouble` > `Curvature2DAngleF1D`

    __init__(*integration_type=IntegrationType.MEAN*)
    :   Builds a Curvature2DAngleF1D object.

        Parameters:
        :   **integration_type** (`freestyle.types.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** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The 2D curvature as an angle.

        Return type:
        :   float

*class* freestyle.functions.CurveMaterialF0D
:   A replacement of the built-in MaterialF0D for stroke creation.
    MaterialF0D does not work with Curves and Strokes. Line color
    priority is used to pick one of the two materials at material
    boundaries.

    Notes: expects instances of CurvePoint to be iterated over
    :   can return None if no fedge can be found

*class* freestyle.functions.CurveNatureF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DEdgeNature` > `CurveNatureF0D`

    __init__()
    :   Builds a CurveNatureF0D object.

    __call__(*it*)
    :   Returns the `freestyle.types.Nature` of the 1D element the
        Interface0D pointed by the Interface0DIterator belongs to.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The nature of the 1D element to which the pointed Interface0D
            belongs.

        Return type:
        :   `freestyle.types.Nature`

*class* freestyle.functions.CurveNatureF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DEdgeNature` > `CurveNatureF1D`

    __init__(*integration_type=IntegrationType.MEAN*)
    :   Builds a CurveNatureF1D object.

        Parameters:
        :   **integration_type** (`freestyle.types.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
        `freestyle.types.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** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The nature of the Interface1D.

        Return type:
        :   `freestyle.types.Nature`

*class* freestyle.functions.DensityF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.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
        `freestyle.types.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** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The density of the image evaluated at the pointed
            Interface0D.

        Return type:
        :   float

*class* freestyle.functions.DensityF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.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** (`freestyle.types.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
        [`freestyle.functions.DensityF0D`](#freestyle.functions.freestyle.functions.DensityF0D "freestyle.functions.freestyle.functions.DensityF0D") functor) with a user-defined
        sampling and then integrated into a single value using a user-defined
        integration method.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The density evaluated for an Interface1D.

        Return type:
        :   float

*class* freestyle.functions.GetCompleteViewMapDensityF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.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** (`freestyle.types.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
        [`freestyle.functions.ReadCompleteViewMapPixelF0D`](#freestyle.functions.freestyle.functions.ReadCompleteViewMapPixelF0D "freestyle.functions.freestyle.functions.ReadCompleteViewMapPixelF0D") functor) and
        then integrated into a single value using a user-defined integration
        method.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The density evaluated for the Interface1D in the complete
            viewmap image.

        Return type:
        :   float

*class* freestyle.functions.GetCurvilinearAbscissaF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DFloat` > `GetCurvilinearAbscissaF0D`

    __init__()
    :   Builds a GetCurvilinearAbscissaF0D object.

    __call__(*it*)
    :   Returns the curvilinear abscissa of the
        `freestyle.types.Interface0D` pointed by the
        Interface0DIterator in the context of its 1D element.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The curvilinear abscissa of the pointed Interface0D.

        Return type:
        :   float

*class* freestyle.functions.GetDirectionalViewMapDensityF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.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** (`freestyle.types.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 explicitly specified by the user. The density is evaluated for a
        set of points along the Interface1D (using the
        [`freestyle.functions.ReadSteerableViewMapPixelF0D`](#freestyle.functions.freestyle.functions.ReadSteerableViewMapPixelF0D "freestyle.functions.freestyle.functions.ReadSteerableViewMapPixelF0D") functor) and
        then integrated into a single value using a user-defined integration
        method.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   the density evaluated for an Interface1D in of the
            steerable viewmaps image.

        Return type:
        :   float

*class* freestyle.functions.GetOccludeeF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DViewShape` > `GetOccludeeF0D`

    __init__()
    :   Builds a GetOccludeeF0D object.

    __call__(*it*)
    :   Returns the `freestyle.types.ViewShape` that the Interface0D
        pointed by the Interface0DIterator occludes.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The ViewShape occluded by the pointed Interface0D.

        Return type:
        :   `freestyle.types.ViewShape`

*class* freestyle.functions.GetOccludeeF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DVectorViewShape` > `GetOccludeeF1D`

    __init__()
    :   Builds a GetOccludeeF1D object.

    __call__(*inter*)
    :   Returns a list of occluded shapes covered by this Interface1D.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   A list of occluded shapes covered by the Interface1D.

        Return type:
        :   list[`freestyle.types.ViewShape`]

*class* freestyle.functions.GetOccludersF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DVectorViewShape` > `GetOccludersF0D`

    __init__()
    :   Builds a GetOccludersF0D object.

    __call__(*it*)
    :   Returns a list of `freestyle.types.ViewShape` occluding the
        `freestyle.types.Interface0D` pointed by the Interface0DIterator.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   A list of ViewShape objects occluding the pointed
            Interface0D.

        Return type:
        :   list[`freestyle.types.ViewShape`]

*class* freestyle.functions.GetOccludersF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DVectorViewShape` > `GetOccludersF1D`

    __init__()
    :   Builds a GetOccludersF1D object.

    __call__(*inter*)
    :   Returns a list of occluding shapes that cover this Interface1D.

        Parameters:
        :   **inter** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   A list of occluding shapes that cover the Interface1D.

        Return type:
        :   list[`freestyle.types.ViewShape`]

*class* freestyle.functions.GetParameterF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DFloat` > `GetParameterF0D`

    __init__()
    :   Builds a GetParameterF0D object.

    __call__(*it*)
    :   Returns the parameter of the `freestyle.types.Interface0D`
        pointed by the Interface0DIterator in the context of its 1D element.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The parameter of an Interface0D.

        Return type:
        :   float

*class* freestyle.functions.GetProjectedXF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DDouble` > `GetProjectedXF0D`

    __init__()
    :   Builds a GetProjectedXF0D object.

    __call__(*it*)
    :   Returns the X 3D projected coordinate of the `freestyle.types.Interface0D`
        pointed by the Interface0DIterator.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The X 3D projected coordinate of the pointed Interface0D.

        Return type:
        :   float

*class* freestyle.functions.GetProjectedXF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DDouble` > `GetProjectedXF1D`

    __init__(*integration_type=IntegrationType.MEAN*)
    :   Builds a GetProjectedXF1D object.

        Parameters:
        :   **integration_type** (`freestyle.types.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** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The projected X 3D coordinate of an Interface1D.

        Return type:
        :   float

*class* freestyle.functions.GetProjectedYF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.UnaryFunction0DDouble` > `GetProjectedYF0D`

    __init__()
    :   Builds a GetProjectedYF0D object.

    __call__(*it*)
    :   Returns the Y 3D projected coordinate of the `freestyle.types.Interface0D`
        pointed by the Interface0DIterator.

        Parameters:
        :   **it** (`freestyle.types.Interface0DIterator`) – An Interface0DIterator object.

        Returns:
        :   The Y 3D projected coordinate of the pointed Interface0D.

        Return type:
        :   float

*class* freestyle.functions.GetProjectedYF1D
:   Class hierarchy: `freestyle.types.UnaryFunction1D` > `freestyle.types.UnaryFunction1DDouble` > `GetProjectedYF1D`

    __init__(*integration_type=IntegrationType.MEAN*)
    :   Builds a GetProjectedYF1D object.

        Parameters:
        :   **integration_type** (`freestyle.types.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** (`freestyle.types.Interface1D`) – An Interface1D object.

        Returns:
        :   The projected Y 3D coordinate of an Interface1D.

        Return type:
        :   float

*class* freestyle.functions.GetProjectedZF0D
:   Class hierarchy: `freestyle.types.UnaryFunction0D` > `freestyle.types.Unary