pyNonLinearVaryingThicknessShader, pySamplingShader, ) from freestyle.types import IntegrationType, Operators Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) ## Splits strokes at points of highest 2D curavture ## when there are too many abrupt turns in it func = pyInverseCurvature2DAngleF0D() Operators.recursive_split(func, pyParameterUP0D(0.2, 0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2) ## Keeps only long enough strokes Operators.select(pyHigherLengthUP1D(100)) ## Sorts so as to draw the longest strokes first ## (this will be done using the causal density) Operators.sort(pyLengthBP1D()) shaders_list = [ pySamplingShader(10), BezierCurveShader(30), SamplingShader(50), ConstantThicknessShader(10), pyNonLinearVaryingThicknessShader(4, 25, 0.6), TextureAssignerShader(6), ConstantColorShader(0.2, 0.2, 0.2, 1.0), TipRemoverShader(10), ] ## Use the causal density to avoid cluttering Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list)
# Authors : Fredo Durand, Stephane Grabli, Francois Sillion, Emmanuel Turquin # Date : 08/04/2005 from freestyle.chainingiterators import ChainSilhouetteIterator from freestyle.predicates import ( QuantitativeInvisibilityUP1D, pyDensityUP1D, pyZBP1D, ) from freestyle.shaders import ( ConstantColorShader, ConstantThicknessShader, SamplingShader, StrokeTextureShader, ) from freestyle.types import IntegrationType, Operators, Stroke Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator()) #Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) Operators.sort(pyZBP1D()) shaders_list = [ StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False), ConstantThicknessShader(3), SamplingShader(5.0), ConstantColorShader(0, 0, 0, 1), ] Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list) #Operators.create(pyDensityFunctorUP1D(8, 0.03, pyGetInverseProjectedZF1D(), 0, 1, IntegrationType.MEAN), shaders_list)
# # ##### END GPL LICENSE BLOCK ##### # Filename : uniformpruning_zsort.py # Authors : Fredo Durand, Stephane Grabli, Francois Sillion, Emmanuel Turquin # Date : 08/04/2005 from freestyle.chainingiterators import ChainSilhouetteIterator from freestyle.predicates import ( QuantitativeInvisibilityUP1D, pyDensityUP1D, pyZBP1D, ) from freestyle.shaders import ( ConstantColorShader, ConstantThicknessShader, SamplingShader, ) from freestyle.types import IntegrationType, Operators, Stroke Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator()) #Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) Operators.sort(pyZBP1D()) shaders_list = [ ConstantThicknessShader(3), SamplingShader(5.0), ConstantColorShader(0, 0, 0, 1), ] Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list)
# Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Selects the lines with high a priori density and # subjects them to the causal density so as to avoid # cluttering from freestyle.chainingiterators import ChainPredicateIterator from freestyle.predicates import ( AndUP1D, NotUP1D, QuantitativeInvisibilityUP1D, TrueBP1D, pyDensityUP1D, pyHighViewMapDensityUP1D, ) from freestyle.shaders import ( ConstantColorShader, ConstantThicknessShader, ) from freestyle.types import IntegrationType, Operators upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST)) Operators.select(upred) bpred = TrueBP1D() Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) shaders_list = [ ConstantThicknessShader(2), ConstantColorShader(0, 0, 0, 1), ] Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list)