Freestyle Predicates (freestyle.predicates)

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

User-defined predicates inherit one of the following base classes, depending on the object type (0D or 1D) to operate on and the arity (unary or binary):

class freestyle.predicates.AndBP1D
class freestyle.predicates.AndUP1D
class freestyle.predicates.ContourUP1D

Class hierarchy: freestyle.types.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 (freestyle.types.Interface1D) – An Interface1D object.
Returns:True if the Interface1D is a contour, false otherwise.
Return type:bool
class freestyle.predicates.DensityLowerThanUP1D

Class hierarchy: freestyle.types.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 freestyle.functions.DensityF0D functor.
__call__(inter)

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

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

Class hierarchy: freestyle.types.UnaryPredicate1D > freestyle.types.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 (freestyle.types.Interface1D) – An Interface1D object.
Returns:True if the time stamp is equal to a user-defined value.
Return type:bool
class freestyle.predicates.EqualToTimeStampUP1D

Class hierarchy: freestyle.types.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 (freestyle.types.Interface1D) – An Interface1D object.
Returns:True if the time stamp is equal to a user-defined value.
Return type:bool
class freestyle.predicates.ExternalContourUP1D

Class hierarchy: freestyle.types.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 (freestyle.types.Interface1D) – An Interface1D object.
Returns:True if the Interface1D is an external contour, false otherwise.
Return type:bool
class freestyle.predicates.FalseBP1D

Class hierarchy: freestyle.types.BinaryPredicate1D > FalseBP1D

__call__(inter1, inter2)

Always returns false.

Parameters:
Returns:

False.

Return type:

bool

class freestyle.predicates.FalseUP0D

Class hierarchy: freestyle.types.UnaryPredicate0D > FalseUP0D

__call__(it)

Always returns false.

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

Class hierarchy: freestyle.types.UnaryPredicate1D > FalseUP1D

__call__(inter)

Always returns false.

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

Class hierarchy: freestyle.types.BinaryPredicate1D > Length2DBP1D

__call__(inter1, inter2)

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

Parameters:
Returns:

True or false.

Return type:

bool

class freestyle.predicates.MaterialBP1D

Checks whether the two supplied ViewEdges have the same material.

class freestyle.predicates.NotBP1D
class freestyle.predicates.NotUP1D
class freestyle.predicates.ObjectNamesUP1D
class freestyle.predicates.OrBP1D
class freestyle.predicates.OrUP1D
class freestyle.predicates.QuantitativeInvisibilityRangeUP1D
class freestyle.predicates.QuantitativeInvisibilityUP1D

Class hierarchy: freestyle.types.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 freestyle.functions.QuantitativeInvisibilityF1D functor, equals a certain user-defined value.

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

Class hierarchy: freestyle.types.BinaryPredicate1D > SameShapeIdBP1D

__call__(inter1, inter2)

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

Parameters:
Returns:

True or false.

Return type:

bool

class freestyle.predicates.ShapeUP1D

Class hierarchy: freestyle.types.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 freestyle.types.Id as the one specified by the user.

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

Class hierarchy: freestyle.types.BinaryPredicate1D > TrueBP1D

__call__(inter1, inter2)

Always returns true.

Parameters:
Returns:

True.

Return type:

bool

class freestyle.predicates.TrueUP0D

Class hierarchy: freestyle.types.UnaryPredicate0D > TrueUP0D

__call__(it)

Always returns true.

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

Class hierarchy: freestyle.types.UnaryPredicate1D > TrueUP1D

__call__(inter)

Always returns true.

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

Class hierarchy: freestyle.types.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 (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: 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:
Returns:

True or false.

Return type:

bool

class freestyle.predicates.WithinImageBoundaryUP1D

Class hierarchy: freestyle.types.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.predicates.pyBackTVertexUP0D

Check whether an Interface0DIterator references a TVertex and is the one that is hidden (inferred from the context).

class freestyle.predicates.pyClosedCurveUP1D
class freestyle.predicates.pyDensityFunctorUP1D
class freestyle.predicates.pyDensityUP1D
class freestyle.predicates.pyDensityVariableSigmaUP1D
class freestyle.predicates.pyHighDensityAnisotropyUP1D
class freestyle.predicates.pyHighDirectionalViewMapDensityUP1D
class freestyle.predicates.pyHighSteerableViewMapDensityUP1D
class freestyle.predicates.pyHighViewMapDensityUP1D
class freestyle.predicates.pyHighViewMapGradientNormUP1D
class freestyle.predicates.pyHigherCurvature2DAngleUP0D
class freestyle.predicates.pyHigherLengthUP1D
class freestyle.predicates.pyHigherNumberOfTurnsUP1D
class freestyle.predicates.pyIsInOccludersListUP1D
class freestyle.predicates.pyIsOccludedByIdListUP1D
class freestyle.predicates.pyIsOccludedByItselfUP1D
class freestyle.predicates.pyIsOccludedByUP1D
class freestyle.predicates.pyLengthBP1D
class freestyle.predicates.pyLowDirectionalViewMapDensityUP1D
class freestyle.predicates.pyLowSteerableViewMapDensityUP1D
class freestyle.predicates.pyNFirstUP1D
class freestyle.predicates.pyNatureBP1D
class freestyle.predicates.pyNatureUP1D
class freestyle.predicates.pyParameterUP0D
class freestyle.predicates.pyParameterUP0DGoodOne
class freestyle.predicates.pyProjectedXBP1D
class freestyle.predicates.pyProjectedYBP1D
class freestyle.predicates.pyShapeIdListUP1D
class freestyle.predicates.pyShapeIdUP1D
class freestyle.predicates.pyShuffleBP1D
class freestyle.predicates.pySilhouetteFirstBP1D
class freestyle.predicates.pyUEqualsUP0D
class freestyle.predicates.pyVertexNatureUP0D
class freestyle.predicates.pyViewMapGradientNormBP1D
class freestyle.predicates.pyZBP1D
class freestyle.predicates.pyZDiscontinuityBP1D
class freestyle.predicates.pyZSmallerUP1D