API users no longer need to define them in user-defined Functions, Predicates and StrokeShaders.
Also removed all .getName() and .getExactTypeName() definitions in pre-defined Functions,
Predicates and StrokeShaders subclasses.
class pyChainSilhouetteIterator(ChainingIterator):
def __init__(self, stayInSelection=True):
ChainingIterator.__init__(self, stayInSelection, True, None, True)
- def getExactTypeName(self):
- return "pyChainSilhouetteIterator"
def init(self):
pass
def traverse(self, iter):
class pyChainSilhouetteGenericIterator(ChainingIterator):
def __init__(self, stayInSelection=True, stayInUnvisited=True):
ChainingIterator.__init__(self, stayInSelection, stayInUnvisited, None, True)
- def getExactTypeName(self):
- return "pyChainSilhouetteGenericIterator"
def init(self):
pass
def traverse(self, iter):
def __init__(self):
ChainingIterator.__init__(self, False, True, None, True)
self._isExternalContour = ExternalContourUP1D()
- def getExactTypeName(self):
- return "pyExternalContourIterator"
def init(self):
self._nEdges = 0
self._isInSelection = 1
ChainingIterator.__init__(self, stayInSelection, False, None, True)
self._timeStamp = GetTimeStampCF()+nRounds
self._nRounds = nRounds
- def getExactTypeName(self):
- return "pySketchyChainSilhouetteIterator"
def init(self):
self._timeStamp = GetTimeStampCF()+self._nRounds
def traverse(self, iter):
ChainingIterator.__init__(self, stayInSelection, False, None, True)
self._timeStamp = GetTimeStampCF()+nRounds
self._nRounds = nRounds
- def getExactTypeName(self):
- return "pySketchyChainingIterator"
def init(self):
self._timeStamp = GetTimeStampCF()+self._nRounds
def traverse(self, iter):
ChainingIterator.__init__(self, False, True, None, True)
self._length = 0
self._percent = float(percent)
- def getExactTypeName(self):
- return "pyFillOcclusionsChainingIterator"
def init(self):
# each time we're evaluating a chain length
# we try to do it once. Thus we reinit
def __init__(self, length):
ChainingIterator.__init__(self, False, True, None, True)
self._length = float(length)
- def getExactTypeName(self):
- return "pySmallFillOcclusionsChainingIterator"
def init(self):
pass
def traverse(self, iter):
self._length = 0
self._absLength = l
self._percent = float(percent)
- def getExactTypeName(self):
- return "pyFillOcclusionsChainingIterator"
def init(self):
# each time we're evaluating a chain length
# we try to do it once. Thus we reinit
self._length = 0
self._absLength = l
self._percent = float(percent)
- def getExactTypeName(self):
- return "pyFillOcclusionsChainingIterator"
def init(self):
# each time we're evaluating a chain length
# we try to do it once. Thus we reinit
class pyNoIdChainSilhouetteIterator(ChainingIterator):
def __init__(self, stayInSelection=True):
ChainingIterator.__init__(self, stayInSelection, True, None, True)
- def getExactTypeName(self):
- return "pyChainSilhouetteIterator"
def init(self):
pass
def traverse(self, iter):
class CurveMaterialF0D(UnaryFunction0DMaterial):
# A replacement of the built-in MaterialF0D for stroke creation.
# MaterialF0D does not work with Curves and Strokes.
- def getName(self):
- return "CurveMaterialF0D"
def __call__(self, inter):
cp = inter.object
assert(isinstance(cp, CurvePoint))
return fe.material if fe.is_smooth else fe.material_left
class pyInverseCurvature2DAngleF0D(UnaryFunction0DDouble):
- def getName(self):
- return "InverseCurvature2DAngleF0D"
-
def __call__(self, inter):
func = Curvature2DAngleF0D()
c = func(inter)
return (3.1415 - c)
class pyCurvilinearLengthF0D(UnaryFunction0DDouble):
- def getName(self):
- return "CurvilinearLengthF0D"
-
def __call__(self, inter):
cp = inter.object
assert(isinstance(cp, CurvePoint))
self.d1Density = ReadSteerableViewMapPixelF0D(1, level)
self.d2Density = ReadSteerableViewMapPixelF0D(2, level)
self.d3Density = ReadSteerableViewMapPixelF0D(3, level)
- def getName(self):
- return "pyDensityAnisotropyF0D"
def __call__(self, inter):
c_iso = self.IsoDensity(inter)
c_0 = self.d0Density(inter)
UnaryFunction0DVec2f.__init__(self)
self._l = l
self._step = pow(2,self._l)
- def getName(self):
- return "pyViewMapGradientVectorF0D"
def __call__(self, iter):
p = iter.object.point_2d
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
UnaryFunction0DDouble.__init__(self)
self._l = l
self._step = pow(2,self._l)
- def getName(self):
- return "pyViewMapGradientNormF0D"
def __call__(self, iter):
p = iter.object.point_2d
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
import string
class pyGetInverseProjectedZF1D(UnaryFunction1DDouble):
- def getName(self):
- return "pyGetInverseProjectedZF1D"
-
def __call__(self, inter):
func = GetProjectedZF1D()
z = func(inter)
return (1.0 - z)
class pyGetSquareInverseProjectedZF1D(UnaryFunction1DDouble):
- def getName(self):
- return "pyGetInverseProjectedZF1D"
-
def __call__(self, inter):
func = GetProjectedZF1D()
z = func(inter)
self._func = pyDensityAnisotropyF0D(level)
self._integration = integrationType
self._sampling = sampling
- def getName(self):
- return "pyDensityAnisotropyF1D"
def __call__(self, inter):
v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
return v
self._func = pyViewMapGradientNormF0D(l)
self._integration = integrationType
self._sampling = sampling
- def getName(self):
- return "pyViewMapGradientNormF1D"
def __call__(self, inter):
v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
return v
from random import *
class pyZBP1D(BinaryPredicate1D):
- def getName(self):
- return "pyZBP1D"
def __call__(self, i1, i2):
func = GetZF1D()
return (func(i1) > func(i2))
def __init__(self, iType = IntegrationType.MEAN):
BinaryPredicate1D.__init__(self)
self._GetZDiscontinuity = ZDiscontinuityF1D(iType)
- def getName(self):
- return "pyZDiscontinuityBP1D"
def __call__(self, i1, i2):
return (self._GetZDiscontinuity(i1) > self._GetZDiscontinuity(i2))
class pyLengthBP1D(BinaryPredicate1D):
- def getName(self):
- return "LengthBP1D"
def __call__(self, i1, i2):
return (i1.length_2d > i2.length_2d)
class pySilhouetteFirstBP1D(BinaryPredicate1D):
- def getName(self):
- return "SilhouetteFirstBP1D"
def __call__(self, inter1, inter2):
bpred = SameShapeIdBP1D()
if (bpred(inter1, inter2) != 1):
return (inter1.nature == inter2.nature)
class pyNatureBP1D(BinaryPredicate1D):
- def getName(self):
- return "NatureBP1D"
def __call__(self, inter1, inter2):
return (inter1.nature & inter2.nature)
def __init__(self,l, sampling=2.0):
BinaryPredicate1D.__init__(self)
self._GetGradient = pyViewMapGradientNormF1D(l, IntegrationType.MEAN)
- def getName(self):
- return "pyViewMapGradientNormBP1D"
def __call__(self, i1,i2):
print("compare gradient")
return (self._GetGradient(i1) > self._GetGradient(i2))
def __init__(self):
BinaryPredicate1D.__init__(self)
seed(1)
- def getName(self):
- return "pyNearAndContourFirstBP1D"
def __call__(self, inter1, inter2):
r1 = uniform(0,1)
r2 = uniform(0,1)
def __init__(self,a):
UnaryPredicate0D.__init__(self)
self._a = a
- def getName(self):
- return "HigherCurvature2DAngleUP0D"
def __call__(self, inter):
func = Curvature2DAngleF0D()
a = func(inter)
UnaryPredicate0D.__init__(self)
self._u = u
self._w = w
- def getName(self):
- return "UEqualsUP0D"
def __call__(self, inter):
func = pyCurvilinearLengthF0D()
u = func(inter)
def __init__(self,nature):
UnaryPredicate0D.__init__(self)
self._nature = nature
- def getName(self):
- return "pyVertexNatureUP0D"
def __call__(self, inter):
v = inter.object
return (v.nature & self._nature) != 0
def __init__(self):
UnaryPredicate0D.__init__(self)
self._getQI = QuantitativeInvisibilityF0D()
- def getName(self):
- return "pyBackTVertexUP0D"
def __call__(self, iter):
if (iter.object.nature & Nature.T_VERTEX) == 0:
return 0
self._m = pmin
self._M = pmax
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
- def getName(self):
- return "pyCurvilinearAbscissaHigherThanUP0D"
def __call__(self, inter):
#s = self.getCurvilinearAbscissa(inter)
u = inter.u
self._m = pmin
self._M = pmax
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
- def getName(self):
- return "pyCurvilinearAbscissaHigherThanUP0D"
def __call__(self, inter):
func = Curvature2DAngleF0D()
c = func(inter)
def __init__(self,l):
UnaryPredicate1D.__init__(self)
self._l = l
- def getName(self):
- return "HigherLengthUP1D"
def __call__(self, inter):
return (inter.length_2d > self._l)
UnaryPredicate1D.__init__(self)
self._nature = nature
self._getNature = CurveNatureF1D()
- def getName(self):
- return "pyNatureUP1D"
def __call__(self, inter):
if(self._getNature(inter) & self._nature):
return 1
UnaryPredicate1D.__init__(self)
self._n = n
self._a = a
- def getName(self):
- return "HigherNumberOfTurnsUP1D"
def __call__(self, inter):
count = 0
func = Curvature2DAngleF0D()
self._threshold = threshold
self._integration = integration
self._func = DensityF1D(self._wsize, self._integration, sampling)
- def getName(self):
- return "pyDensityUP1D"
def __call__(self, inter):
if self._func(inter) < self._threshold:
return 1
self._threshold = threshold
self._level = level
self._integration = integration
- def getName(self):
- return "pyLowSteerableViewMapDensityUP1D"
def __call__(self, inter):
func = GetSteerableViewMapDensityF1D(self._level, self._integration)
v = func(inter)
self._orientation = orientation
self._level = level
self._integration = integration
- def getName(self):
- return "pyLowDirectionalViewMapDensityUP1D"
def __call__(self, inter):
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration)
v = func(inter)
self._level = level
self._integration = integration
self._func = GetSteerableViewMapDensityF1D(self._level, self._integration)
- def getName(self):
- return "pyHighSteerableViewMapDensityUP1D"
def __call__(self, inter):
v = self._func(inter)
if v > self._threshold:
self._level = level
self._integration = integration
self._sampling = sampling
- def getName(self):
- return "pyLowDirectionalViewMapDensityUP1D"
def __call__(self, inter):
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration, self._sampling)
v = func(inter)
self._integration = integration
self._sampling = sampling
self._func = GetCompleteViewMapDensityF1D(self._level, self._integration, self._sampling) # 2.0 is the smpling
- def getName(self):
- return "pyHighViewMapDensityUP1D"
def __call__(self, inter):
#print("toto")
- #print(func.getName())
- #print(inter.getExactTypeName())
+ #print(func.name)
+ #print(inter.name)
v= self._func(inter)
if v > self._threshold:
return 1
self._funcmin = float(funcmin)
self._funcmax = float(funcmax)
self._integration = integration
- def getName(self):
- return "pyDensityFunctorUP1D"
def __call__(self, inter):
func = DensityF1D(self._wsize, self._integration)
res = self._functor(inter)
UnaryPredicate1D.__init__(self)
self._z = z
self._integration = integration
- def getName(self):
- return "pyZSmallerUP1D"
def __call__(self, inter):
func = GetProjectedZF1D(self._integration)
if func(inter) < self._z:
def __init__(self,id):
UnaryPredicate1D.__init__(self)
self._id = id
- def getName(self):
- return "pyIsOccludedByUP1D"
def __call__(self, inter):
func = GetShapeF1D()
shapes = func(inter)
def __init__(self,id):
UnaryPredicate1D.__init__(self)
self._id = id
- def getName(self):
- return "pyIsInOccludersListUP1D"
def __call__(self, inter):
func = GetOccludersF1D()
occluders = func(inter)
UnaryPredicate1D.__init__(self)
self.__func1 = GetOccludersF1D()
self.__func2 = GetShapeF1D()
- def getName(self):
- return "pyIsOccludedByItselfUP1D"
def __call__(self, inter):
lst1 = self.__func1(inter)
lst2 = self.__func2(inter)
UnaryPredicate1D.__init__(self)
self._idlist = idlist
self.__func1 = GetOccludersF1D()
- def getName(self):
- return "pyIsOccludedByIdListUP1D"
def __call__(self, inter):
lst1 = self.__func1(inter)
for vs1 in lst1:
self._funcs = []
for _id in idlist :
self._funcs.append(ShapeUP1D(_id.first, _id.second))
- def getName(self):
- return "pyShapeIdUP1D"
def __call__(self, inter):
for func in self._funcs :
if func(inter) == 1:
def __init__(self, _id):
UnaryPredicate1D.__init__(self)
self._id = _id
- def getName(self):
- return "pyShapeIdUP1D"
def __call__(self, inter):
func = GetShapeF1D()
shapes = func(inter)
UnaryPredicate1D.__init__(self)
self._l = threshold
self.func = pyDensityAnisotropyF1D(level, IntegrationType.MEAN, sampling)
- def getName(self):
- return "pyHighDensityAnisotropyUP1D"
def __call__(self, inter):
return (self.func(inter) > self._l)
UnaryPredicate1D.__init__(self)
self._threshold = threshold
self._GetGradient = pyViewMapGradientNormF1D(l, IntegrationType.MEAN)
- def getName(self):
- return "pyHighViewMapGradientNormUP1D"
def __call__(self, inter):
gn = self._GetGradient(inter)
#print(gn)
self._tmax = tmax
self._integration = integration
self._sampling = sampling
- def getName(self):
- return "pyDensityUP1D"
def __call__(self, inter):
sigma = (self._sigmaMax-self._sigmaMin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._sigmaMin
t = (self._tmax-self._tmin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._tmin
UnaryPredicate1D.__init__(self)
self.__pred1 = pred1
self.__pred2 = pred2
-
- def getName(self):
- return "AndUP1D"
-
def __call__(self, inter):
return self.__pred1(inter) and self.__pred2(inter)
UnaryPredicate1D.__init__(self)
self.__pred1 = pred1
self.__pred2 = pred2
-
- def getName(self):
- return "OrUP1D"
-
def __call__(self, inter):
return self.__pred1(inter) or self.__pred2(inter)
def __init__(self, pred):
UnaryPredicate1D.__init__(self)
self.__pred = pred
-
- def getName(self):
- return "NotUP1D"
-
def __call__(self, inter):
return self.__pred(inter) == 0
self._integration = integration
self._func = DensityF1D(self._wsize, self._integration, sampling)
self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling)
-
- def getName(self):
- return "pyDensityUP1D"
-
def __call__(self, inter):
c = self._func(inter)
m = self._func2(inter)
return outer, inner
class BaseColorShader(ConstantColorShader):
- def getName(self):
- return "BaseColorShader"
+ pass
class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn):
def __init__(self, thickness, position, ratio):
self.__inner = thickness * (1 - ratio)
else:
raise ValueError("unknown thickness position: " + self.position)
- def getName(self):
- return "BaseThicknessShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
it.increment()
class ColorAlongStrokeShader(ColorRampModifier):
- def getName(self):
- return "ColorAlongStrokeShader"
def shade(self, stroke):
for it, t in iter_t2d_along_stroke(stroke):
sv = it.object
sv.attribute.color = self.blend_ramp(a, b)
class AlphaAlongStrokeShader(CurveMappingModifier):
- def getName(self):
- return "AlphaAlongStrokeShader"
def shade(self, stroke):
for it, t in iter_t2d_along_stroke(stroke):
sv = it.object
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
self.__value_min = value_min
self.__value_max = value_max
- def getName(self):
- return "ThicknessAlongStrokeShader"
def shade(self, stroke):
for it, t in iter_t2d_along_stroke(stroke):
sv = it.object
ColorRampModifier.__init__(self, blend, influence, ramp)
self.__range_min = range_min
self.__range_max = range_max
- def getName(self):
- return "ColorDistanceFromCameraShader"
def shade(self, stroke):
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
sv = it.object
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
self.__range_min = range_min
self.__range_max = range_max
- def getName(self):
- return "AlphaDistanceFromCameraShader"
def shade(self, stroke):
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
sv = it.object
self.__range_max = range_max
self.__value_min = value_min
self.__value_max = value_max
- def getName(self):
- return "ThicknessDistanceFromCameraShader"
def shade(self, stroke):
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
sv = it.object
self.__target = target
self.__range_min = range_min
self.__range_max = range_max
- def getName(self):
- return "ColorDistanceFromObjectShader"
def shade(self, stroke):
if self.__target is None:
return
self.__target = target
self.__range_min = range_min
self.__range_max = range_max
- def getName(self):
- return "AlphaDistanceFromObjectShader"
def shade(self, stroke):
if self.__target is None:
return
self.__range_max = range_max
self.__value_min = value_min
self.__value_max = value_max
- def getName(self):
- return "ThicknessDistanceFromObjectShader"
def shade(self, stroke):
if self.__target is None:
return
ColorRampModifier.__init__(self, blend, influence, ramp)
self.__material_attr = material_attr
self.__use_ramp = use_ramp
- def getName(self):
- return "ColorMaterialShader"
def shade(self, stroke):
if self.__material_attr in ["DIFF", "SPEC"] and not self.__use_ramp:
for it, b in iter_material_color(stroke, self.__material_attr):
def __init__(self, blend, influence, mapping, invert, curve, material_attr):
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
self.__material_attr = material_attr
- def getName(self):
- return "AlphaMaterialShader"
def shade(self, stroke):
for it, t in iter_material_value(stroke, self.__material_attr):
sv = it.object
self.__material_attr = material_attr
self.__value_min = value_min
self.__value_max = value_max
- def getName(self):
- return "ThicknessMaterialShader"
def shade(self, stroke):
for it, t in iter_material_value(stroke, self.__material_attr):
sv = it.object
self._amplitude = amplitude
self._phase = phase / wavelength * 2 * math.pi
self._getNormal = Normal2DF0D()
- def getName(self):
- return "SinusDisplacementShader"
def shade(self, stroke):
for it, distance in iter_distance_along_stroke(stroke):
v = it.object
self.__amp = amp
self.__oct = oct
self.__dir = Vector([cos(angle), sin(angle)])
- def getName(self):
- return "PerlinNoise1DShader"
def shade(self, stroke):
length = stroke.length_2d
it = stroke.stroke_vertices_begin()
self.__amp = amp
self.__oct = oct
self.__dir = Vector([cos(angle), sin(angle)])
- def getName(self):
- return "PerlinNoise2DShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
self.__end = end
self.__xy = Vector([x, y])
self.__getNormal = Normal2DF0D()
- def getName(self):
- return "Offset2DShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
self.__pivot_u = pivot_u
self.__pivot_x = pivot_x
self.__pivot_y = pivot_y
- def getName(self):
- return "Transform2DShader"
def shade(self, stroke):
# determine the pivot of scaling and rotation operations
if self.__pivot == "START":
self.__getQI = QuantitativeInvisibilityF1D()
self.__qi_start = qi_start
self.__qi_end = qi_end
- def getName(self):
- return "QuantitativeInvisibilityRangeUP1D"
def __call__(self, inter):
qi = self.__getQI(inter)
return self.__qi_start <= qi <= self.__qi_end
UnaryPredicate1D.__init__(self)
self._names = names
self._negative = negative
- def getName(self):
- return "ObjectNamesUP1D"
def __call__(self, viewEdge):
found = viewEdge.viewshape.name in self._names
if self._negative:
def __init__(self, pattern):
StrokeShader.__init__(self)
self._pattern = pattern
- def getName(self):
- return "DashedLineShader"
def shade(self, stroke):
index = 0 # pattern index
start = 0.0 # 2D curvilinear length
def __init__(self, angle):
BinaryPredicate1D.__init__(self)
self._angle = angle
- def getName(self):
- return "AngleLargerThanBP1D"
def __call__(self, i1, i2):
sv1a = i1.first_fedge.first_svertex.point_2d
sv1b = i1.last_fedge.second_svertex.point_2d
BinaryPredicate1D.__init__(self)
self.__pred1 = pred1
self.__pred2 = pred2
- def getName(self):
- return "AndBP1D"
def __call__(self, i1, i2):
return self.__pred1(i1, i2) and self.__pred2(i1, i2)
UnaryPredicate1D.__init__(self)
self._min_length = min_length
self._max_length = max_length
- def getName(self):
- return "LengthThresholdUP1D"
def __call__(self, inter):
length = inter.length_2d
if self._min_length is not None and length < self._min_length:
# predicates for splitting
class MaterialBoundaryUP0D(UnaryPredicate0D):
- def getName(self):
- return "MaterialBoundaryUP0D"
def __call__(self, it):
if it.is_begin:
return False
self._min_angle = min_angle
self._max_angle = max_angle
self._func = Curvature2DAngleF0D()
- def getName(self):
- return "Curvature2DAngleThresholdUP0D"
def __call__(self, inter):
angle = math.pi - self._func(inter)
if self._min_angle is not None and angle < self._min_angle:
UnaryPredicate0D.__init__(self)
self._length_limit = length_limit
self._t = 0.0
- def getName(self):
- return "Length2DThresholdUP0D"
def __call__(self, inter):
t = inter.t # curvilinear abscissa
if t < self._t:
self.__min = float(min)
self.__max = float(max)
self.__func = ZDiscontinuityF0D()
- def getName(self):
- return "pyDepthDiscontinuityThicknessShader"
def shade(self, stroke):
z_min=0.0
z_max=1.0
def __init__(self, thickness):
StrokeShader.__init__(self)
self._thickness = thickness
- def getName(self):
- return "pyConstantThicknessShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
def __init__(self, thickness):
StrokeShader.__init__(self)
self._thickness = thickness
- def getName(self):
- return "pyFXSThicknessShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
self.threshold_max= threshold_max
self._thicknessMin = thicknessMin
self._thicknessMax = thicknessMax
- def getName(self):
- return "pyVaryingThicknessWithDensityShader"
def shade(self, stroke):
n = stroke.stroke_vertices_size()
i = 0
StrokeShader.__init__(self)
self._thicknessMin = thicknessMin
self._thicknessMax = thicknessMax
- def getName(self):
- return "pyIncreasingThicknessShader"
def shade(self, stroke):
n = stroke.stroke_vertices_size()
i = 0
self._thicknessMin = thicknessMin
self._thicknessMax = thicknessMax
self._ratio = ratio
- def getName(self):
- return "pyConstrainedIncreasingThicknessShader"
def shade(self, stroke):
slength = stroke.length_2d
tmp = self._ratio*slength
StrokeShader.__init__(self)
self._thicknessMin = thicknessMin
self._thicknessMax = thicknessMax
- def getName(self):
- return "pyDecreasingThicknessShader"
def shade(self, stroke):
l = stroke.length_2d
tMax = self._thicknessMax
self._thicknessMin = thicknessMiddle
self._thicknessMax = thicknessExtremity
self._exponent = exponent
- def getName(self):
- return "pyNonLinearVaryingThicknessShader"
def shade(self, stroke):
n = stroke.stroke_vertices_size()
i = 0
self._thicknessMin = thicknessMin
self._thicknessMax = thicknessMax
self._omega = omega
- def getName(self):
- return "pySLERPThicknessShader"
def shade(self, stroke):
slength = stroke.length_2d
tmp = 0.33*slength
StrokeShader.__init__(self)
self._a = a
self._n = n
- def getName(self):
- return "pyTVertexThickenerShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
predTVertex = pyVertexNatureUP0D(Nature.T_VERTEX)
self._w = float(w)
self._kmin = float(kmin)
self._kmax = float(kmax)
- def getName(self):
- return "pyImportanceThicknessShader"
def shade(self, stroke):
origin = Vector([self._x, self._y])
it = stroke.stroke_vertices_begin()
self._w = float(w)
self._kmin = float(kmin)
self._kmax = float(kmax)
- def getName(self):
- return "pyImportance3DThicknessShader"
def shade(self, stroke):
origin = Vector([self._x, self._y, self._z])
it = stroke.stroke_vertices_begin()
self.__min = min
self.__max = max
self.__func = GetProjectedZF0D()
- def getName(self):
- return "pyZDependingThicknessShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
z_min = 1
self._g = g
self._b = b
self._a = a
- def getName(self):
- return "pyConstantColorShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
StrokeShader.__init__(self)
self._c1 = [r1,g1,b1,a1]
self._c2 = [r2,g2,b2,a2]
- def getName(self):
- return "pyIncreasingColorShader"
def shade(self, stroke):
n = stroke.stroke_vertices_size() - 1
inc = 0
StrokeShader.__init__(self)
self._c1 = [r1,g1,b1,a1]
self._c2 = [r2,g2,b2,a2]
- def getName(self):
- return "pyInterpolateColorShader"
def shade(self, stroke):
n = stroke.stroke_vertices_size() - 1
inc = 0
def __init__(self, threshold=50):
StrokeShader.__init__(self)
self._threshold = threshold
- def getName(self):
- return "pyMaterialColorShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
func = MaterialF0D()
def __init__(self, s=1):
StrokeShader.__init__(self)
seed(s)
- def getName(self):
- return "pyRandomColorShader"
def shade(self, stroke):
## pick a random color
c0 = float(uniform(15,75))/100.0
it.increment()
class py2DCurvatureColorShader(StrokeShader):
- def getName(self):
- return "py2DCurvatureColorShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
func = Curvature2DAngleF0D()
def __init__(self, sampling):
StrokeShader.__init__(self)
self._sampling = sampling
- def getName(self):
- return "pySamplingShader"
def shade(self, stroke):
stroke.resample(float(self._sampling))
stroke.update_length()
def __init__(self, l):
StrokeShader.__init__(self)
self._l = l
- def getName(self):
- return "pyBackboneStretcherShader"
def shade(self, stroke):
it0 = stroke.stroke_vertices_begin()
it1 = StrokeVertexIterator(it0)
def __init__(self, l):
StrokeShader.__init__(self)
self._l = l
- def getName(self):
- return "pyBackboneStretcherShader"
def shade(self, stroke):
l = stroke.length_2d
stretch = self._l*l
## Shader to replace a stroke by its corresponding tangent
class pyGuidingLineShader(StrokeShader):
- def getName(self):
- return "pyGuidingLineShader"
- ## shading method
def shade(self, stroke):
it = stroke.stroke_vertices_begin() ## get the first vertex
itlast = stroke.stroke_vertices_end() ##
def __init__(self, l):
StrokeShader.__init__(self)
self._l = l
- def getName(self):
- return "pyBackboneStretcherNoCuspShader"
def shade(self, stroke):
it0 = stroke.stroke_vertices_begin()
it1 = StrokeVertexIterator(it0)
self._nbIter = nbIter
self._normalInfo = Normal2DF0D()
self._curvatureInfo = Curvature2DAngleF0D()
- def getName(self):
- return "pyDiffusionShader"
def shade(self, stroke):
for i in range (1, self._nbIter):
it = stroke.stroke_vertices_begin()
def __init__(self, l):
StrokeShader.__init__(self)
self._l = l
- def getName(self):
- return "pyTipRemoverShader"
def shade(self, stroke):
originalSize = stroke.stroke_vertices_size()
if originalSize < 4:
stroke.update_length()
class pyTVertexRemoverShader(StrokeShader):
- def getName(self):
- return "pyTVertexRemoverShader"
def shade(self, stroke):
if stroke.stroke_vertices_size() <= 3:
return
StrokeShader.__init__(self)
self._v1 = Vector([x1,y1])
self._v2 = Vector([x2,y2])
- def getName(self):
- return "pyExtremitiesOrientationShader"
def shade(self, stroke):
#print(self._v1.x,self._v1.y)
stroke.setBeginningOrientation(self._v1.x,self._v1.y)
return it1.get_fedge(it2)
class pyHLRShader(StrokeShader):
- def getName(self):
- return "pyHLRShader"
def shade(self, stroke):
originalSize = stroke.stroke_vertices_size()
if originalSize < 4:
def __init__(self):
StrokeShader.__init__(self)
self._Get2dDirection = Orientation2DF1D()
- def getName(self):
- return "pyTVertexOrientationShader"
## finds the TVertex orientation from the TVertex and
## the previous or next edge
def findOrientation(self, tv, ve):
self._f = f
self._a = a
self._getNormal = Normal2DF0D()
- def getName(self):
- return "pySinusDisplacementShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
v = it.object
- #print(self._getNormal.getName())
+ #print(self._getNormal.name)
n = self._getNormal(Interface0DIterator(it))
p = v.point
u = v.u
self.__freq = freq
self.__amp = amp
self.__oct = oct
- def getName(self):
- return "pyPerlinNoise1DShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
self.__freq = freq
self.__amp = amp
self.__oct = oct
- def getName(self):
- return "pyPerlinNoise2DShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
self.__turns = turns
self.__random_center = random_center
self.__random_radius = random_radius
- def getName(self):
- return "pyBluePrintCirclesShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
if it.is_end:
self.__turns = turns
self.__random_center = random_center
self.__random_radius = random_radius
- def getName(self):
- return "pyBluePrintEllipsesShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
if it.is_end:
self.__turns = turns
self.__bb_len = bb_len
self.__bb_rand = bb_rand
- def getName(self):
- return "pyBluePrintSquaresShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
if it.is_end:
self.__mult = mult
self.__turns = turns
self.__bb_len = 1 + float(bb_len) / 100
- def getName(self):
- return "pyBluePrintDirectedSquaresShader"
def shade(self, stroke):
stroke.resample(32 * self.__turns)
p_mean = Vector([0, 0])
StrokeShader.__init__(self)
self.__min = min
self.__max = max
- def getName(self):
- return "pyModulateAlphaShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
## various
class pyDummyShader(StrokeShader):
- def getName(self):
- return "pyDummyShader"
def shade(self, stroke):
it = stroke.stroke_vertices_begin()
while not it.is_end:
it.increment()
class pyDebugShader(StrokeShader):
- def getName(self):
- return "pyDebugShader"
def shade(self, stroke):
fe = GetSelectedFEdgeCF()
id1 = fe.first_svertex.id
static PyObject * Iterator_repr(BPy_Iterator* self)
{
- return PyUnicode_FromFormat("type: %s - address: %p", self->it->getExactTypeName().c_str(), self->it);
+ return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->it);
}
PyDoc_STRVAR(Iterator_increment_doc,
static PyObject * StrokeShader___repr__(BPy_StrokeShader* self)
{
- return PyUnicode_FromFormat("type: %s - address: %p", self->ss->getName().c_str(), self->ss);
+ return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->ss);
}
static char StrokeShader_shade___doc__[] =
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it;
if (!if0D_it) {
- string msg(self->up0D->getName() + " has no Interface0DIterator");
- PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ string class_name(Py_TYPE(self)->tp_name);
+ PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str());
return NULL;
}
if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) {
Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D;
if (!if1D) {
- string msg(self->up1D->getName() + " has no Interface0DIterator");
- PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ string class_name(Py_TYPE(self)->tp_name);
+ PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str());
return NULL;
}
if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) {