Freestyle Python API improvements - part 9.
* Fix for wild card import statements (e.g., "from Freestyle import *") was done. Now import statements are either without using "from" or with all imported names explicitly listed. * GNU GPL header blocks were added to Python programs. Additional code clean-up was also made. * Removed freestyle_init.py and extra-lines.sml that were no longer used.
This commit is contained in:
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : ChainingIterators.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Chaining Iterators to be used with chaining operators
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,12 +11,17 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
# Filename : ChainingIterators.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Chaining Iterators to be used with chaining operators
|
||||
|
||||
from Freestyle import AdjacencyIterator, ChainingIterator, ExternalContourUP1D, Nature, TVertex
|
||||
from Freestyle import ContextFunctions as CF
|
||||
|
||||
## the natural chaining iterator
|
||||
|
@@ -1,6 +1,29 @@
|
||||
from freestyle_init import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import Curvature2DAngleF0D, CurvePoint, ReadCompleteViewMapPixelF0D, \
|
||||
ReadSteerableViewMapPixelF0D, UnaryFunction0DDouble, UnaryFunction0DMaterial, \
|
||||
UnaryFunction0DVec2f
|
||||
from Freestyle import ContextFunctions as CF
|
||||
|
||||
import math
|
||||
import mathutils
|
||||
|
||||
class CurveMaterialF0D(UnaryFunction0DMaterial):
|
||||
# A replacement of the built-in MaterialF0D for stroke creation.
|
||||
# MaterialF0D does not work with Curves and Strokes.
|
||||
@@ -53,23 +76,25 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
|
||||
def __init__(self, l):
|
||||
UnaryFunction0DVec2f.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
self._step = math.pow(2,self._l)
|
||||
def __call__(self, iter):
|
||||
p = iter.object.point_2d
|
||||
gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
return Vector([gx, gy])
|
||||
gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y)) - \
|
||||
CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step)) - \
|
||||
CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
return mathutils.Vector([gx, gy])
|
||||
|
||||
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
||||
def __init__(self, l):
|
||||
UnaryFunction0DDouble.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
self._step = math.pow(2,self._l)
|
||||
def __call__(self, iter):
|
||||
p = iter.object.point_2d
|
||||
gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
grad = Vector([gx, gy])
|
||||
gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y)) - \
|
||||
CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step)) - \
|
||||
CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
|
||||
grad = mathutils.Vector([gx, gy])
|
||||
return grad.length
|
||||
|
||||
|
||||
|
@@ -1,5 +1,23 @@
|
||||
from freestyle_init import *
|
||||
from Functions0D import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import GetProjectedZF1D, IntegrationType, UnaryFunction1DDouble, integrate
|
||||
from Functions0D import pyDensityAnisotropyF0D, pyViewMapGradientNormF0D
|
||||
import string
|
||||
|
||||
class pyGetInverseProjectedZF1D(UnaryFunction1DDouble):
|
||||
|
@@ -1,6 +1,25 @@
|
||||
from freestyle_init import *
|
||||
from Functions1D import *
|
||||
from random import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import BinaryPredicate1D, GetZF1D, IntegrationType, Nature, SameShapeIdBP1D, ZDiscontinuityF1D
|
||||
from Functions1D import pyViewMapGradientNormF1D
|
||||
|
||||
import random
|
||||
|
||||
class pyZBP1D(BinaryPredicate1D):
|
||||
def __call__(self, i1, i2):
|
||||
@@ -42,8 +61,8 @@ class pyViewMapGradientNormBP1D(BinaryPredicate1D):
|
||||
class pyShuffleBP1D(BinaryPredicate1D):
|
||||
def __init__(self):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
seed(1)
|
||||
random.seed(1)
|
||||
def __call__(self, inter1, inter2):
|
||||
r1 = uniform(0,1)
|
||||
r2 = uniform(0,1)
|
||||
r1 = random.uniform(0,1)
|
||||
r2 = random.uniform(0,1)
|
||||
return (r1<r2)
|
||||
|
@@ -1,5 +1,23 @@
|
||||
from freestyle_init import *
|
||||
from Functions0D import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import Curvature2DAngleF0D, Nature, QuantitativeInvisibilityF0D, UnaryPredicate0D
|
||||
from Functions0D import pyCurvilinearLengthF0D
|
||||
|
||||
class pyHigherCurvature2DAngleUP0D(UnaryPredicate0D):
|
||||
def __init__(self,a):
|
||||
|
@@ -1,5 +1,25 @@
|
||||
from freestyle_init import *
|
||||
from Functions1D import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import Curvature2DAngleF0D, CurveNatureF1D, DensityF1D, GetCompleteViewMapDensityF1D, \
|
||||
GetDirectionalViewMapDensityF1D, GetOccludersF1D, GetProjectedZF1D, GetShapeF1D, GetSteerableViewMapDensityF1D, \
|
||||
IntegrationType, ShapeUP1D, TVertex, UnaryPredicate1D
|
||||
from Functions1D import pyDensityAnisotropyF1D, pyViewMapGradientNormF1D
|
||||
|
||||
count = 0
|
||||
class pyNFirstUP1D(UnaryPredicate1D):
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : anisotropic_diffusion.py
|
||||
# Author : Fredo Durand
|
||||
# Date : 12/08/2004
|
||||
# Purpose : Smoothes lines using an anisotropic diffusion scheme
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,28 +11,34 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from shaders import *
|
||||
# Filename : anisotropic_diffusion.py
|
||||
# Author : Fredo Durand
|
||||
# Date : 12/08/2004
|
||||
# Purpose : Smoothes lines using an anisotropic diffusion scheme
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ConstantThicknessShader, ExternalContourUP1D, IncreasingColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader, TrueBP1D, TrueUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
from shaders import pyDiffusion2Shader
|
||||
|
||||
# pyDiffusion2Shader parameters
|
||||
offset = 0.25
|
||||
nbIter = 30
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select( upred )
|
||||
Operators.select(upred)
|
||||
bpred = TrueBP1D()
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(4),
|
||||
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
|
||||
SamplingShader(2),
|
||||
pyDiffusion2Shader(offset, nbIter),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1)
|
||||
pyDiffusion2Shader(offset, nbIter),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : apriori_and_causal_density.py
|
||||
# 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
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,24 +11,29 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : apriori_and_causal_density.py
|
||||
# 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_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
from Freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \
|
||||
Operators, QuantitativeInvisibilityUP1D, TrueBP1D
|
||||
from PredicatesU1D import pyDensityUP1D, pyHighViewMapDensityUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
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.0, 0.0,1)
|
||||
]
|
||||
Operators.create(pyDensityUP1D(1,0.1, IntegrationType.MEAN), shaders_list)
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0, 0, 0, 1),
|
||||
]
|
||||
Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : apriori_density.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines having a high a priori density
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,17 +11,20 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : apriori_density.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines having a high a priori density
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
from Freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D
|
||||
from PredicatesU1D import pyHighViewMapDensityUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5)))
|
||||
bpred = TrueBP1D()
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : backbone_stretcher.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Stretches the geometry of visible lines
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,17 +11,25 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : backbone_stretcher.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Stretches the geometry of visible lines
|
||||
|
||||
from Freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ConstantColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [TextureAssignerShader(4), ConstantColorShader(0.5, 0.5, 0.5), BackboneStretcherShader(20)]
|
||||
shaders_list = [
|
||||
TextureAssignerShader(4),
|
||||
ConstantColorShader(0.5, 0.5, 0.5),
|
||||
BackboneStretcherShader(20),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : blueprint_circles.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using circular contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,16 +11,21 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : blueprint_circles.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using circular contour strokes
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU1D import pyHigherLengthUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
from shaders import pyBluePrintCirclesShader, pyPerlinNoise1DShader
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
@@ -37,10 +33,10 @@ Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintCirclesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 15, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1)
|
||||
]
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintCirclesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 15, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : blueprint_ellipses.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using elliptic contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,27 +11,32 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : blueprint_ellipses.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using elliptic contour strokes
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU1D import pyHigherLengthUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
from shaders import pyBluePrintEllipsesShader, pyPerlinNoise1DShader
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintEllipsesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1)
|
||||
]
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintEllipsesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,12 +1,4 @@
|
||||
# Filename : blueprint_squares.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using square contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -19,27 +11,33 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : blueprint_squares.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using square contour strokes
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU1D import pyHigherLengthUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
from shaders import pyBluePrintSquaresShader, pyPerlinNoise1DShader
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(8),
|
||||
pyBluePrintSquaresShader(2, 20),
|
||||
pyPerlinNoise1DShader(0.07, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3),
|
||||
ConstantThicknessShader(4)
|
||||
]
|
||||
ConstantThicknessShader(8),
|
||||
pyBluePrintSquaresShader(2, 20),
|
||||
pyPerlinNoise1DShader(0.07, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3),
|
||||
ConstantThicknessShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : cartoon.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws colored lines. The color is automatically
|
||||
# infered from each object's material in a cartoon-like
|
||||
# fashion.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,21 +11,28 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : cartoon.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws colored lines. The color is automatically
|
||||
# infered from each object's material in a cartoon-like
|
||||
# fashion.
|
||||
|
||||
from Freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import pyMaterialColorShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
BezierCurveShader(3),
|
||||
ConstantThicknessShader(4),
|
||||
pyMaterialColorShader(0.8)
|
||||
]
|
||||
shaders_list = [
|
||||
BezierCurveShader(3),
|
||||
ConstantThicknessShader(4),
|
||||
pyMaterialColorShader(0.8),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws each object's visible contour
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,23 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws each object's visible contour
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D() ) )
|
||||
bpred = SameShapeIdBP1D();
|
||||
from Freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import pyMaterialColorShader
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()))
|
||||
bpred = SameShapeIdBP1D()
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5.0),
|
||||
IncreasingColorShader(0.8,0,0,1,0.1,0,0,1)
|
||||
]
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5.0),
|
||||
IncreasingColorShader(0.8,0,0,1,0.1,0,0,1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : curvature2d.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The stroke points are colored in gray levels and depending
|
||||
# on the 2d curvature value
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,14 +11,21 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from shaders import *
|
||||
# Filename : curvature2d.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The stroke points are colored in gray levels and depending
|
||||
# on the 2d curvature value
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, Stroke, StrokeTextureShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import py2DCurvatureColorShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,24 +11,26 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
ExternalContourUP1D, Operators, QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred )
|
||||
bpred = TrueBP1D();
|
||||
Operators.select(upred)
|
||||
bpred = TrueBP1D()
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0,1)
|
||||
]
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : external_contour_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene using a sketchy
|
||||
# chaining iterator (in particular each ViewEdge can be drawn
|
||||
# several times
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,27 +11,33 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : external_contour_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene using a sketchy
|
||||
# chaining iterator (in particular each ViewEdge can be drawn
|
||||
# several times
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
from ChainingIterators import pySketchyChainingIterator
|
||||
from Freestyle import ExternalContourUP1D, IncreasingColorShader, IncreasingThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \
|
||||
TextureAssignerShader, TrueUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(pySketchyChainingIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(10, 150, 2, 1, 1),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(10, 150, 2, 1, 1),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : external_contour_smooth.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws a smooth external contour
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,25 +11,29 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
from ChainingIterators import *
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : external_contour_smooth.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws a smooth external contour
|
||||
|
||||
from Freestyle import ChainPredicateIterator, ExternalContourUP1D, IncreasingColorShader, \
|
||||
IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \
|
||||
SmoothingShader, TrueBP1D, TrueUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
bpred = TrueBP1D();
|
||||
bpred = TrueBP1D()
|
||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
IncreasingThicknessShader(4,20),
|
||||
IncreasingColorShader(1.0, 0.0, 0.5,1, 0.5,1, 0.3, 1),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
IncreasingThicknessShader(4,20),
|
||||
IncreasingColorShader(1.0, 0.0, 0.5,1, 0.5,1, 0.3, 1),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,3 +0,0 @@
|
||||
1suggestive.py
|
||||
1ridges.py
|
||||
1nor_suggestive_or_ridges.py
|
@@ -1,2 +0,0 @@
|
||||
from Freestyle import *
|
||||
from mathutils import Vector
|
@@ -1,16 +1,4 @@
|
||||
#
|
||||
# Filename : haloing.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : This style module selects the lines that
|
||||
# are connected (in the image) to a specific
|
||||
# object and trims them in order to produce
|
||||
# a haloing effect around the target shape
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -23,28 +11,36 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : haloing.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : This style module selects the lines that
|
||||
# are connected (in the image) to a specific
|
||||
# object and trims them in order to produce
|
||||
# a haloing effect around the target shape
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, Id, IncreasingColorShader, IncreasingThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D
|
||||
from PredicatesU1D import pyIsOccludedByUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
from shaders import pyTVertexRemoverShader
|
||||
|
||||
# id corresponds to the id of the target object
|
||||
# (accessed by SHIFT+click)
|
||||
id = Id(3,0)
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0) , pyIsOccludedByUP1D(id))
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyIsOccludedByUP1D(id))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
IncreasingColorShader(1,0,0, 1,0,1,0,1),
|
||||
SamplingShader(1.0),
|
||||
pyTVertexRemoverShader(),
|
||||
TipRemoverShader(3.0)
|
||||
]
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
IncreasingColorShader(1,0,0, 1,0,1,0,1),
|
||||
SamplingShader(1.0),
|
||||
pyTVertexRemoverShader(),
|
||||
TipRemoverShader(3.0),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : ignore_small_oclusions.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The strokes are drawn through small occlusions
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,22 +11,26 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : ignore_small_oclusions.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The strokes are drawn through small occlusions
|
||||
|
||||
from ChainingIterators import pyFillOcclusionsAbsoluteChainingIterator
|
||||
from Freestyle import ConstantColorShader, ConstantThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
#Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1))
|
||||
Operators.bidirectional_chain(pyFillOcclusionsAbsoluteChainingIterator(12))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : invisible_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws all lines whose Quantitative Invisibility
|
||||
# is different from 0
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,22 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : invisible_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws all lines whose Quantitative Invisibility
|
||||
# is different from 0
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
upred = NotUP1D(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3.0),
|
||||
ConstantColorShader(0.7,0.7,0.7)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3.0),
|
||||
ConstantColorShader(0.7, 0.7, 0.7),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : japanese_bigbrush.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Simulates a big brush fr oriental painting
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,41 +11,46 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from shaders import *
|
||||
# Filename : japanese_bigbrush.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Simulates a big brush fr oriental painting
|
||||
|
||||
from Freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \
|
||||
ConstantThicknessShader, IntegrationType, Operators, QuantitativeInvisibilityUP1D, \
|
||||
SamplingShader, TextureAssignerShader, TipRemoverShader
|
||||
from Functions0D import pyInverseCurvature2DAngleF0D
|
||||
from PredicatesB1D import pyLengthBP1D
|
||||
from PredicatesU0D import pyParameterUP0D
|
||||
from PredicatesU1D import pyDensityUP1D, pyHigherLengthUP1D, pyHigherNumberOfTurnsUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import pyNonLinearVaryingThicknessShader, pySamplingShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(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)
|
||||
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)
|
||||
]
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list)
|
||||
|
@@ -1,4 +1,22 @@
|
||||
from freestyle_init import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import UnaryPredicate1D
|
||||
|
||||
class AndUP1D(UnaryPredicate1D):
|
||||
def __init__(self, pred1, pred2):
|
||||
@@ -17,8 +35,8 @@ class OrUP1D(UnaryPredicate1D):
|
||||
return self.__pred1(inter) or self.__pred2(inter)
|
||||
|
||||
class NotUP1D(UnaryPredicate1D):
|
||||
def __init__(self, pred):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__pred = pred
|
||||
def __call__(self, inter):
|
||||
return self.__pred(inter) == 0
|
||||
def __init__(self, pred):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__pred = pred
|
||||
def __call__(self, inter):
|
||||
return not self.__pred(inter)
|
||||
|
@@ -1,20 +1,4 @@
|
||||
#
|
||||
# Filename : long_anisotropically_dense.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Selects the lines that are long and have a high anisotropic
|
||||
# a priori density and uses causal density
|
||||
# to draw without cluttering. Ideally, half of the
|
||||
# selected lines are culled using the causal density.
|
||||
#
|
||||
# ********************* WARNING *************************************
|
||||
# ******** The Directional a priori density maps must ******
|
||||
# ******** have been computed prior to using this style module ******
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -27,38 +11,47 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from Functions1D import *
|
||||
from shaders import *
|
||||
# Filename : long_anisotropically_dense.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Selects the lines that are long and have a high anisotropic
|
||||
# a priori density and uses causal density
|
||||
# to draw without cluttering. Ideally, half of the
|
||||
# selected lines are culled using the causal density.
|
||||
#
|
||||
# ********************* WARNING *************************************
|
||||
# ******** The Directional a priori density maps must ******
|
||||
# ******** have been computed prior to using this style module ******
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, DensityF1D, \
|
||||
IntegrationType, Operators, QuantitativeInvisibilityUP1D, SamplingShader, UnaryPredicate1D
|
||||
from PredicatesB1D import pyLengthBP1D
|
||||
from PredicatesU1D import pyHighDensityAnisotropyUP1D, pyHigherLengthUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
## custom density predicate
|
||||
class pyDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,wsize,threshold, integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = threshold
|
||||
self._integration = integration
|
||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||
self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling)
|
||||
def __call__(self, inter):
|
||||
c = self._func(inter)
|
||||
m = self._func2(inter)
|
||||
if(c < self._threshold):
|
||||
return 1
|
||||
if( m > 4* c ):
|
||||
if ( c < 1.5*self._threshold ):
|
||||
return 1
|
||||
return 0
|
||||
def __init__(self, wsize, threshold, integration=IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = threshold
|
||||
self._integration = integration
|
||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||
self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling)
|
||||
def __call__(self, inter):
|
||||
c = self._func(inter)
|
||||
m = self._func2(inter)
|
||||
if c < self._threshold:
|
||||
return 1
|
||||
if m > 4*c:
|
||||
if c < 1.5*self._threshold:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
@@ -66,12 +59,10 @@ Operators.select(pyHigherLengthUP1D(40))
|
||||
## selects lines having a high anisotropic a priori density
|
||||
Operators.select(pyHighDensityAnisotropyUP1D(0.3,4))
|
||||
Operators.sort(pyLengthBP1D())
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0.2,0.2,0.25,1),
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0.2,0.2,0.25,1),
|
||||
]
|
||||
## uniform culling
|
||||
Operators.create(pyDensityUP1D(3.0,2.0e-2, IntegrationType.MEAN, 0.1), shaders_list)
|
||||
|
||||
|
||||
|
@@ -1,19 +1,4 @@
|
||||
#
|
||||
# Filename : multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The thickness and the color of the strokes vary continuously
|
||||
# independently from occlusions although only
|
||||
# visible lines are actually drawn. This is equivalent
|
||||
# to assigning the thickness using a parameterization covering
|
||||
# the complete silhouette (visible+invisible) and drawing
|
||||
# the strokes using a second parameterization that only
|
||||
# covers the visible portions.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -26,26 +11,37 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The thickness and the color of the strokes vary continuously
|
||||
# independently from occlusions although only
|
||||
# visible lines are actually drawn. This is equivalent
|
||||
# to assigning the thickness using a parameterization covering
|
||||
# the complete silhouette (visible+invisible) and drawing
|
||||
# the strokes using a second parameterization that only
|
||||
# covers the visible portions.
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingColorShader, \
|
||||
IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \
|
||||
TextureAssignerShader, TrueUP1D
|
||||
from shaders import pyHLRShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## Chain following the same nature, but without the restriction
|
||||
## of staying inside the selection (0).
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(0))
|
||||
shaders_list = [
|
||||
SamplingShader(20),
|
||||
IncreasingThicknessShader(1.5, 30),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(-1),
|
||||
pyHLRShader() ## this shader draws only visible portions
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(20),
|
||||
IncreasingThicknessShader(1.5, 30),
|
||||
ConstantColorShader(0.0, 0.0, 0.0),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(-1),
|
||||
pyHLRShader(), ## this shader draws only visible portions
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,17 +1,4 @@
|
||||
#
|
||||
# Filename : nature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Uses the NatureUP1D predicate to select the lines
|
||||
# of a given type (among Nature.SILHOUETTE, Nature.CREASE, Nature.SUGGESTIVE_CONTOURS,
|
||||
# Nature.BORDERS).
|
||||
# The suggestive contours must have been enabled in the
|
||||
# options dialog to appear in the View Map.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -24,20 +11,29 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : nature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Uses the NatureUP1D predicate to select the lines
|
||||
# of a given type (among Nature.SILHOUETTE, Nature.CREASE, Nature.SUGGESTIVE_CONTOURS,
|
||||
# Nature.BORDERS).
|
||||
# The suggestive contours must have been enabled in the
|
||||
# options dialog to appear in the View Map.
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, IncreasingColorShader, \
|
||||
IncreasingThicknessShader, Nature, Operators, TrueUP1D
|
||||
from PredicatesU1D import pyNatureUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(pyNatureUP1D(Nature.SILHOUETTE))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D( pyNatureUP1D( Nature.SILHOUETTE) ) )
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 10),
|
||||
IncreasingColorShader(0.0,0.0,0.0, 1, 0.8,0,0,1)
|
||||
]
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(pyNatureUP1D(Nature.SILHOUETTE)))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 10),
|
||||
IncreasingColorShader(0.0, 0.0, 0.0, 1, 0.8, 0, 0, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : near_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the lines that are "closer" than a threshold
|
||||
# (between 0 and 1)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,24 +11,28 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : near_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the lines that are "closer" than a threshold
|
||||
# (between 0 and 1)
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
IntegrationType, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU1D import pyZSmallerUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN))
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
TextureAssignerShader(-1),
|
||||
ConstantThicknessShader(5),
|
||||
ConstantColorShader(0.0, 0.0, 0.0)
|
||||
]
|
||||
shaders_list = [
|
||||
TextureAssignerShader(-1),
|
||||
ConstantThicknessShader(5),
|
||||
ConstantColorShader(0.0, 0.0, 0.0),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : occluded_by_specific_object.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws only the lines that are occluded by a given object
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,26 +11,30 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : occluded_by_specific_object.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws only the lines that are occluded by a given object
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Id, Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from PredicatesU1D import pyIsInOccludersListUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
## the id of the occluder (use SHIFT+click on the ViewMap to
|
||||
## retrieve ids)
|
||||
id = Id(3,0)
|
||||
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)),
|
||||
pyIsInOccludersListUP1D(id))
|
||||
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)), pyIsInOccludersListUP1D(id))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.3,0.3,0.3,1)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.3, 0.3, 0.3, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -21,10 +21,17 @@ import math
|
||||
import mathutils
|
||||
import time
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
from ChainingIterators import pySketchyChainSilhouetteIterator, pySketchyChainingIterator
|
||||
from Freestyle import BackboneStretcherShader, BezierCurveShader, BinaryPredicate1D, ChainPredicateIterator, \
|
||||
ChainSilhouetteIterator, ConstantColorShader, ContourUP1D, Curvature2DAngleF0D, ExternalContourUP1D, \
|
||||
FalseBP1D, FalseUP1D, GuidingLinesShader, Interface0DIterator, Nature, Noise, Normal2DF0D, Operators, \
|
||||
PolygonalizationShader, QuantitativeInvisibilityF1D, QuantitativeInvisibilityUP1D, SamplingShader, \
|
||||
SpatialNoiseShader, StrokeAttribute, StrokeShader, TipRemoverShader, TrueBP1D, TrueUP1D, UnaryPredicate0D, \
|
||||
UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D
|
||||
from Functions0D import CurveMaterialF0D
|
||||
from PredicatesU1D import pyNatureUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D, OrUP1D
|
||||
from shaders import pyBluePrintCirclesShader, pyBluePrintEllipsesShader, pyBluePrintSquaresShader
|
||||
|
||||
class ColorRampModifier(StrokeShader):
|
||||
def __init__(self, blend, influence, ramp):
|
||||
@@ -498,7 +505,7 @@ class PerlinNoise1DShader(StrokeShader):
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
self.__dir = Vector([cos(angle), sin(angle)])
|
||||
self.__dir = mathutils.Vector([math.cos(angle), math.sin(angle)])
|
||||
def shade(self, stroke):
|
||||
length = stroke.length_2d
|
||||
it = stroke.stroke_vertices_begin()
|
||||
@@ -516,12 +523,12 @@ class PerlinNoise2DShader(StrokeShader):
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
self.__dir = Vector([cos(angle), sin(angle)])
|
||||
self.__dir = mathutils.Vector([math.cos(angle), math.sin(angle)])
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
v = it.object
|
||||
vec = Vector([v.projected_x, v.projected_y])
|
||||
vec = mathutils.Vector([v.projected_x, v.projected_y])
|
||||
nres = self.__noise.turbulence2(vec, self.__freq, self.__amp, self.__oct)
|
||||
v.point = v.point + nres * self.__dir
|
||||
it.increment()
|
||||
@@ -532,7 +539,7 @@ class Offset2DShader(StrokeShader):
|
||||
StrokeShader.__init__(self)
|
||||
self.__start = start
|
||||
self.__end = end
|
||||
self.__xy = Vector([x, y])
|
||||
self.__xy = mathutils.Vector([x, y])
|
||||
self.__getNormal = Normal2DF0D()
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
@@ -582,7 +589,7 @@ class Transform2DShader(StrokeShader):
|
||||
delta = u - self.__pivot_u
|
||||
pivot = p + delta * (prev - p)
|
||||
elif self.__pivot == "CENTER":
|
||||
pivot = Vector([0.0, 0.0])
|
||||
pivot = mathutils.Vector([0.0, 0.0])
|
||||
n = 0
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -593,7 +600,7 @@ class Transform2DShader(StrokeShader):
|
||||
pivot.x = pivot.x / n
|
||||
pivot.y = pivot.y / n
|
||||
elif self.__pivot == "ABSOLUTE":
|
||||
pivot = Vector([self.__pivot_x, self.__pivot_y])
|
||||
pivot = mathutils.Vector([self.__pivot_x, self.__pivot_y])
|
||||
# apply scaling and rotation operations
|
||||
cos_theta = math.cos(self.__angle)
|
||||
sin_theta = math.sin(self.__angle)
|
||||
@@ -662,7 +669,7 @@ class RoundCapShader(StrokeShader):
|
||||
# save the location and attribute of stroke vertices
|
||||
buffer = []
|
||||
for sv in iter_stroke_vertices(stroke):
|
||||
buffer.append((Vector(sv.point), StrokeAttribute(sv.attribute)))
|
||||
buffer.append((mathutils.Vector(sv.point), StrokeAttribute(sv.attribute)))
|
||||
nverts = len(buffer)
|
||||
if nverts < 2:
|
||||
return
|
||||
@@ -714,7 +721,7 @@ class SquareCapShader(StrokeShader):
|
||||
# save the location and attribute of stroke vertices
|
||||
buffer = []
|
||||
for sv in iter_stroke_vertices(stroke):
|
||||
buffer.append((Vector(sv.point), StrokeAttribute(sv.attribute)))
|
||||
buffer.append((mathutils.Vector(sv.point), StrokeAttribute(sv.attribute)))
|
||||
nverts = len(buffer)
|
||||
if nverts < 2:
|
||||
return
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : polygonalize.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Make the strokes more "polygonal"
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,21 +11,26 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : polygonalize.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Make the strokes more "polygonal"
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, PolygonalizationShader, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
PolygonalizationShader(8)
|
||||
]
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0),
|
||||
PolygonalizationShader(8),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : qi0.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,21 +11,26 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : qi0.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(4.0),
|
||||
ConstantColorShader(0.0,0.0,0.0)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(4.0),
|
||||
ConstantColorShader(0.0, 0.0, 0.0)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : qi0_not_external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# that do not belong to the external contour of the scene
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,23 +11,31 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
# Filename : qi0_not_external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# that do not belong to the external contour of the scene
|
||||
|
||||
from Freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ExternalContourUP1D, \
|
||||
IncreasingColorShader, IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, \
|
||||
SamplingShader, SpatialNoiseShader, TextureAssignerShader, TrueUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(4, 150, 2, True, True),
|
||||
IncreasingThicknessShader(2, 5),
|
||||
BackboneStretcherShader(20),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(4, 150, 2, True, True),
|
||||
IncreasingThicknessShader(2, 5),
|
||||
BackboneStretcherShader(20),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : qi1.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by one surface.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,21 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : qi1.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by one surface.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(1))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1)))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.5,0.5,0.5, 1)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.5, 0.5, 0.5, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : qi2.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by two surfaces.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,21 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
# Filename : qi2.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by two surfaces.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(2))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2)))
|
||||
shaders_list = [
|
||||
SamplingShader(10),
|
||||
ConstantThicknessShader(1.5),
|
||||
ConstantColorShader(0.7,0.7,0.7, 1)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(10),
|
||||
ConstantThicknessShader(1.5),
|
||||
ConstantColorShader(0.7, 0.7, 0.7, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : sequentialsplit_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Use the sequential split with two different
|
||||
# predicates to specify respectively the starting and
|
||||
# the stopping extremities for strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,16 +11,22 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from Functions0D import *
|
||||
# Filename : sequentialsplit_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Use the sequential split with two different
|
||||
# predicates to specify respectively the starting and
|
||||
# the stopping extremities for strokes
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, Nature, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SpatialNoiseShader, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU0D import pyBackTVertexUP0D, pyVertexNatureUP0D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
upred = QuantitativeInvisibilityUP1D(0)
|
||||
Operators.select(upred)
|
||||
@@ -41,10 +36,9 @@ start = pyVertexNatureUP0D(Nature.NON_T_VERTEX)
|
||||
stop = pyBackTVertexUP0D()
|
||||
Operators.sequential_split(start, stop, 10)
|
||||
shaders_list = [
|
||||
SpatialNoiseShader(7, 120, 2, True, True),
|
||||
IncreasingThicknessShader(5, 8),
|
||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
SpatialNoiseShader(7, 120, 2, True, True),
|
||||
IncreasingThicknessShader(5, 8),
|
||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
|
@@ -1,12 +1,30 @@
|
||||
from freestyle_init import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import AdjacencyIterator, Curvature2DAngleF0D, DensityF0D, GetProjectedZF0D, \
|
||||
Interface0DIterator, MaterialF0D, Nature, Noise, Normal2DF0D, Orientation2DF1D, \
|
||||
StrokeAttribute, StrokeShader, StrokeVertexIterator, ZDiscontinuityF0D
|
||||
from Freestyle import ContextFunctions as CF
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from random import *
|
||||
from math import *
|
||||
from PredicatesU0D import pyVertexNatureUP0D
|
||||
|
||||
import math
|
||||
import mathutils
|
||||
import random
|
||||
|
||||
## thickness modifiers
|
||||
######################
|
||||
@@ -149,8 +167,7 @@ class pyDecreasingThicknessShader(StrokeShader):
|
||||
it.increment()
|
||||
|
||||
def smoothC(a, exp):
|
||||
c = pow(float(a),exp)*pow(2.0,exp)
|
||||
return c
|
||||
return math.pow(float(a), exp) * math.pow(2.0, exp)
|
||||
|
||||
class pyNonLinearVaryingThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessExtremity, thicknessMiddle, exponent):
|
||||
@@ -192,9 +209,9 @@ class pySLERPThicknessShader(StrokeShader):
|
||||
while not it.is_end:
|
||||
c = float(i)/float(n)
|
||||
if i < float(n)/2.0:
|
||||
t = sin((1-c)*self._omega)/sinh(self._omega)*self._thicknessMin + sin(c*self._omega)/sinh(self._omega) * maxT
|
||||
t = math.sin((1-c)*self._omega)/math.sinh(self._omega)*self._thicknessMin + math.sin(c*self._omega)/math.sinh(self._omega) * maxT
|
||||
else:
|
||||
t = sin((1-c)*self._omega)/sinh(self._omega)*maxT + sin(c*self._omega)/sinh(self._omega) * self._thicknessMin
|
||||
t = math.sin((1-c)*self._omega)/math.sinh(self._omega)*maxT + math.sin(c*self._omega)/math.sinh(self._omega) * self._thicknessMin
|
||||
it.object.attribute.thickness = (t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
@@ -255,11 +272,11 @@ class pyImportance2DThicknessShader(StrokeShader):
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
def shade(self, stroke):
|
||||
origin = Vector([self._x, self._y])
|
||||
origin = mathutils.Vector([self._x, self._y])
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
v = it.object
|
||||
p = Vector([v.projected_x, v.projected_y])
|
||||
p = mathutils.Vector([v.projected_x, v.projected_y])
|
||||
d = (p-origin).length
|
||||
if d > self._w:
|
||||
k = self._kmin
|
||||
@@ -280,7 +297,7 @@ class pyImportance3DThicknessShader(StrokeShader):
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
def shade(self, stroke):
|
||||
origin = Vector([self._x, self._y, self._z])
|
||||
origin = mathutils.Vector([self._x, self._y, self._z])
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
v = it.object
|
||||
@@ -373,7 +390,7 @@ class pyInterpolateColorShader(StrokeShader):
|
||||
while not it.is_end:
|
||||
att = it.object.attribute
|
||||
u = float(inc)/float(n)
|
||||
c = 1-2*(fabs(u-0.5))
|
||||
c = 1-2*(math.fabs(u-0.5))
|
||||
att.color = ((1-c)*self._c1[0] + c*self._c2[0],
|
||||
(1-c)*self._c1[1] + c*self._c2[1],
|
||||
(1-c)*self._c1[2] + c*self._c2[2])
|
||||
@@ -411,7 +428,7 @@ class pyMaterialColorShader(StrokeShader):
|
||||
u = 4.*X / (X + 15.*Y + 3.*Z)
|
||||
v = 9.*Y / (X + 15.*Y + 3.*Z)
|
||||
|
||||
L= 116. * pow((Y/Yn),(1./3.)) -16
|
||||
L= 116. * math.pow((Y/Yn),(1./3.)) -16
|
||||
U = 13. * L * (u - un)
|
||||
V = 13. * L * (v - vn)
|
||||
|
||||
@@ -425,7 +442,7 @@ class pyMaterialColorShader(StrokeShader):
|
||||
u = U / (13. * L) + un
|
||||
v = V / (13. * L) + vn
|
||||
|
||||
Y = Yn * pow( ((L+16.)/116.), 3.)
|
||||
Y = Yn * math.pow( ((L+16.)/116.), 3.)
|
||||
X = -9. * Y * u / ((u - 4.)* v - u * v)
|
||||
Z = (9. * Y - 15*v*Y - v*X) /( 3. * v)
|
||||
|
||||
@@ -443,12 +460,12 @@ class pyMaterialColorShader(StrokeShader):
|
||||
class pyRandomColorShader(StrokeShader):
|
||||
def __init__(self, s=1):
|
||||
StrokeShader.__init__(self)
|
||||
seed(s)
|
||||
random.seed(s)
|
||||
def shade(self, stroke):
|
||||
## pick a random color
|
||||
c0 = float(uniform(15,75))/100.0
|
||||
c1 = float(uniform(15,75))/100.0
|
||||
c2 = float(uniform(15,75))/100.0
|
||||
c0 = float(random.uniform(15,75))/100.0
|
||||
c1 = float(random.uniform(15,75))/100.0
|
||||
c2 = float(random.uniform(15,75))/100.0
|
||||
print(c0, c1, c2)
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -506,10 +523,10 @@ class pyBackboneStretcherShader(StrokeShader):
|
||||
v1 = it1.object
|
||||
vn_1 = itn_1.object
|
||||
vn = itn.object
|
||||
p0 = Vector([v0.projected_x, v0.projected_y])
|
||||
pn = Vector([vn.projected_x, vn.projected_y])
|
||||
p1 = Vector([v1.projected_x, v1.projected_y])
|
||||
pn_1 = Vector([vn_1.projected_x, vn_1.projected_y])
|
||||
p0 = mathutils.Vector([v0.projected_x, v0.projected_y])
|
||||
pn = mathutils.Vector([vn.projected_x, vn.projected_y])
|
||||
p1 = mathutils.Vector([v1.projected_x, v1.projected_y])
|
||||
pn_1 = mathutils.Vector([vn_1.projected_x, vn_1.projected_y])
|
||||
d1 = p0-p1
|
||||
d1.normalize()
|
||||
dn = pn-pn_1
|
||||
@@ -538,10 +555,10 @@ class pyLengthDependingBackboneStretcherShader(StrokeShader):
|
||||
v1 = it1.object
|
||||
vn_1 = itn_1.object
|
||||
vn = itn.object
|
||||
p0 = Vector([v0.projected_x, v0.projected_y])
|
||||
pn = Vector([vn.projected_x, vn.projected_y])
|
||||
p1 = Vector([v1.projected_x, v1.projected_y])
|
||||
pn_1 = Vector([vn_1.projected_x, vn_1.projected_y])
|
||||
p0 = mathutils.Vector([v0.projected_x, v0.projected_y])
|
||||
pn = mathutils.Vector([vn.projected_x, vn.projected_y])
|
||||
p1 = mathutils.Vector([v1.projected_x, v1.projected_y])
|
||||
pn_1 = mathutils.Vector([vn_1.projected_x, vn_1.projected_y])
|
||||
d1 = p0-p1
|
||||
d1.normalize()
|
||||
dn = pn-pn_1
|
||||
@@ -683,8 +700,8 @@ class pyTVertexRemoverShader(StrokeShader):
|
||||
class pyExtremitiesOrientationShader(StrokeShader):
|
||||
def __init__(self, x1,y1,x2=0,y2=0):
|
||||
StrokeShader.__init__(self)
|
||||
self._v1 = Vector([x1,y1])
|
||||
self._v2 = Vector([x2,y2])
|
||||
self._v1 = mathutils.Vector([x1,y1])
|
||||
self._v2 = mathutils.Vector([x2,y2])
|
||||
def shade(self, stroke):
|
||||
#print(self._v1.x,self._v1.y)
|
||||
stroke.setBeginningOrientation(self._v1.x,self._v1.y)
|
||||
@@ -808,11 +825,11 @@ class pySinusDisplacementShader(StrokeShader):
|
||||
n = self._getNormal(Interface0DIterator(it))
|
||||
p = v.point
|
||||
u = v.u
|
||||
a = self._a*(1-2*(fabs(u-0.5)))
|
||||
n = n*a*cos(self._f*u*6.28)
|
||||
a = self._a*(1-2*(math.fabs(u-0.5)))
|
||||
n = n*a*math.cos(self._f*u*6.28)
|
||||
#print(n.x, n.y)
|
||||
v.point = p+n
|
||||
#v.point = v.point+n*a*cos(f*v.u)
|
||||
#v.point = v.point+n*a*math.cos(f*v.u)
|
||||
it.increment()
|
||||
stroke.update_length()
|
||||
|
||||
@@ -844,7 +861,7 @@ class pyPerlinNoise2DShader(StrokeShader):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
v = it.object
|
||||
vec = Vector([v.projected_x, v.projected_y])
|
||||
vec = mathutils.Vector([v.projected_x, v.projected_y])
|
||||
nres = self.__noise.turbulence2(vec, self.__freq, self.__amp, self.__oct)
|
||||
v.point = (v.projected_x + nres, v.projected_y + nres)
|
||||
it.increment()
|
||||
@@ -883,7 +900,7 @@ class pyBluePrintCirclesShader(StrokeShader):
|
||||
sv_nb = sv_nb // self.__turns
|
||||
center = (p_min + p_max) / 2
|
||||
radius = (center.x - p_min.x + center.y - p_min.y) / 2
|
||||
p_new = Vector([0, 0])
|
||||
p_new = mathutils.Vector([0, 0])
|
||||
#######################################################
|
||||
R = self.__random_radius
|
||||
C = self.__random_center
|
||||
@@ -892,14 +909,14 @@ class pyBluePrintCirclesShader(StrokeShader):
|
||||
for j in range(self.__turns):
|
||||
prev_radius = radius
|
||||
prev_center = center
|
||||
radius = radius + randint(-R, R)
|
||||
center = center + Vector([randint(-C, C), randint(-C, C)])
|
||||
radius = radius + random.randint(-R, R)
|
||||
center = center + mathutils.Vector([random.randint(-C, C), random.randint(-C, C)])
|
||||
while i < sv_nb and not it.is_end:
|
||||
t = float(i) / float(sv_nb - 1)
|
||||
r = prev_radius + (radius - prev_radius) * t
|
||||
c = prev_center + (center - prev_center) * t
|
||||
p_new.x = c.x + r * cos(2 * pi * t)
|
||||
p_new.y = c.y + r * sin(2 * pi * t)
|
||||
p_new.x = c.x + r * math.cos(2 * math.pi * t)
|
||||
p_new.y = c.y + r * math.sin(2 * math.pi * t)
|
||||
it.object.point = p_new
|
||||
i = i + 1
|
||||
it.increment()
|
||||
@@ -940,7 +957,7 @@ class pyBluePrintEllipsesShader(StrokeShader):
|
||||
sv_nb = sv_nb // self.__turns
|
||||
center = (p_min + p_max) / 2
|
||||
radius = center - p_min
|
||||
p_new = Vector([0, 0])
|
||||
p_new = mathutils.Vector([0, 0])
|
||||
#######################################################
|
||||
R = self.__random_radius
|
||||
C = self.__random_center
|
||||
@@ -949,14 +966,14 @@ class pyBluePrintEllipsesShader(StrokeShader):
|
||||
for j in range(self.__turns):
|
||||
prev_radius = radius
|
||||
prev_center = center
|
||||
radius = radius + Vector([randint(-R, R), randint(-R, R)])
|
||||
center = center + Vector([randint(-C, C), randint(-C, C)])
|
||||
radius = radius + mathutils.Vector([random.randint(-R, R), random.randint(-R, R)])
|
||||
center = center + mathutils.Vector([random.randint(-C, C), random.randint(-C, C)])
|
||||
while i < sv_nb and not it.is_end:
|
||||
t = float(i) / float(sv_nb - 1)
|
||||
r = prev_radius + (radius - prev_radius) * t
|
||||
c = prev_center + (center - prev_center) * t
|
||||
p_new.x = c.x + r.x * cos(2 * pi * t)
|
||||
p_new.y = c.y + r.y * sin(2 * pi * t)
|
||||
p_new.x = c.x + r.x * math.cos(2 * math.pi * t)
|
||||
p_new.y = c.y + r.y * math.sin(2 * math.pi * t)
|
||||
it.object.point = p_new
|
||||
i = i + 1
|
||||
it.increment()
|
||||
@@ -1001,28 +1018,28 @@ class pyBluePrintSquaresShader(StrokeShader):
|
||||
second = 2 * first
|
||||
third = 3 * first
|
||||
fourth = sv_nb
|
||||
p_first = Vector([p_min.x - self.__bb_len, p_min.y])
|
||||
p_first_end = Vector([p_max.x + self.__bb_len, p_min.y])
|
||||
p_second = Vector([p_max.x, p_min.y - self.__bb_len])
|
||||
p_second_end = Vector([p_max.x, p_max.y + self.__bb_len])
|
||||
p_third = Vector([p_max.x + self.__bb_len, p_max.y])
|
||||
p_third_end = Vector([p_min.x - self.__bb_len, p_max.y])
|
||||
p_fourth = Vector([p_min.x, p_max.y + self.__bb_len])
|
||||
p_fourth_end = Vector([p_min.x, p_min.y - self.__bb_len])
|
||||
p_first = mathutils.Vector([p_min.x - self.__bb_len, p_min.y])
|
||||
p_first_end = mathutils.Vector([p_max.x + self.__bb_len, p_min.y])
|
||||
p_second = mathutils.Vector([p_max.x, p_min.y - self.__bb_len])
|
||||
p_second_end = mathutils.Vector([p_max.x, p_max.y + self.__bb_len])
|
||||
p_third = mathutils.Vector([p_max.x + self.__bb_len, p_max.y])
|
||||
p_third_end = mathutils.Vector([p_min.x - self.__bb_len, p_max.y])
|
||||
p_fourth = mathutils.Vector([p_min.x, p_max.y + self.__bb_len])
|
||||
p_fourth_end = mathutils.Vector([p_min.x, p_min.y - self.__bb_len])
|
||||
#######################################################
|
||||
R = self.__bb_rand
|
||||
r = self.__bb_rand // 2
|
||||
it = stroke.stroke_vertices_begin()
|
||||
visible = True
|
||||
for j in range(self.__turns):
|
||||
p_first = p_first + Vector([randint(-R, R), randint(-r, r)])
|
||||
p_first_end = p_first_end + Vector([randint(-R, R), randint(-r, r)])
|
||||
p_second = p_second + Vector([randint(-r, r), randint(-R, R)])
|
||||
p_second_end = p_second_end + Vector([randint(-r, r), randint(-R, R)])
|
||||
p_third = p_third + Vector([randint(-R, R), randint(-r, r)])
|
||||
p_third_end = p_third_end + Vector([randint(-R, R), randint(-r, r)])
|
||||
p_fourth = p_fourth + Vector([randint(-r, r), randint(-R, R)])
|
||||
p_fourth_end = p_fourth_end + Vector([randint(-r, r), randint(-R, R)])
|
||||
p_first = p_first + mathutils.Vector([random.randint(-R, R), random.randint(-r, r)])
|
||||
p_first_end = p_first_end + mathutils.Vector([random.randint(-R, R), random.randint(-r, r)])
|
||||
p_second = p_second + mathutils.Vector([random.randint(-r, r), random.randint(-R, R)])
|
||||
p_second_end = p_second_end + mathutils.Vector([random.randint(-r, r), random.randint(-R, R)])
|
||||
p_third = p_third + mathutils.Vector([random.randint(-R, R), random.randint(-r, r)])
|
||||
p_third_end = p_third_end + mathutils.Vector([random.randint(-R, R), random.randint(-r, r)])
|
||||
p_fourth = p_fourth + mathutils.Vector([random.randint(-r, r), random.randint(-R, R)])
|
||||
p_fourth_end = p_fourth_end + mathutils.Vector([random.randint(-r, r), random.randint(-R, R)])
|
||||
vec_first = p_first_end - p_first
|
||||
vec_second = p_second_end - p_second
|
||||
vec_third = p_third_end - p_third
|
||||
@@ -1074,7 +1091,7 @@ class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
self.__bb_len = 1 + float(bb_len) / 100
|
||||
def shade(self, stroke):
|
||||
stroke.resample(32 * self.__turns)
|
||||
p_mean = Vector([0, 0])
|
||||
p_mean = mathutils.Vector([0, 0])
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
p = it.object.point
|
||||
@@ -1088,8 +1105,8 @@ class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
p = it.object.point
|
||||
p_var_xx = p_var_xx + pow(p.x - p_mean.x, 2)
|
||||
p_var_yy = p_var_yy + pow(p.y - p_mean.y, 2)
|
||||
p_var_xx = p_var_xx + math.pow(p.x - p_mean.x, 2)
|
||||
p_var_yy = p_var_yy + math.pow(p.y - p_mean.y, 2)
|
||||
p_var_xy = p_var_xy + (p.x - p_mean.x) * (p.y - p_mean.y)
|
||||
it.increment()
|
||||
p_var_xx = p_var_xx / sv_nb
|
||||
@@ -1098,18 +1115,18 @@ class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
## print(p_var_xx, p_var_yy, p_var_xy)
|
||||
trace = p_var_xx + p_var_yy
|
||||
det = p_var_xx * p_var_yy - p_var_xy * p_var_xy
|
||||
sqrt_coeff = sqrt(trace * trace - 4 * det)
|
||||
sqrt_coeff = math.sqrt(trace * trace - 4 * det)
|
||||
lambda1 = (trace + sqrt_coeff) / 2
|
||||
lambda2 = (trace - sqrt_coeff) / 2
|
||||
## print(lambda1, lambda2)
|
||||
theta = atan(2 * p_var_xy / (p_var_xx - p_var_yy)) / 2
|
||||
theta = math.atan(2 * p_var_xy / (p_var_xx - p_var_yy)) / 2
|
||||
## print(theta)
|
||||
if p_var_yy > p_var_xx:
|
||||
e1 = Vector([cos(theta + pi / 2), sin(theta + pi / 2)]) * sqrt(lambda1) * self.__mult
|
||||
e2 = Vector([cos(theta + pi), sin(theta + pi)]) * sqrt(lambda2) * self.__mult
|
||||
e1 = mathutils.Vector([math.cos(theta + math.pi / 2), math.sin(theta + math.pi / 2)]) * math.sqrt(lambda1) * self.__mult
|
||||
e2 = mathutils.Vector([math.cos(theta + math.pi), math.sin(theta + math.pi)]) * math.sqrt(lambda2) * self.__mult
|
||||
else:
|
||||
e1 = Vector([cos(theta), sin(theta)]) * sqrt(lambda1) * self.__mult
|
||||
e2 = Vector([cos(theta + pi / 2), sin(theta + pi / 2)]) * sqrt(lambda2) * self.__mult
|
||||
e1 = mathutils.Vector([math.cos(theta), math.sin(theta)]) * math.sqrt(lambda1) * self.__mult
|
||||
e2 = mathutils.Vector([math.cos(theta + math.pi / 2), math.sin(theta + math.pi / 2)]) * math.sqrt(lambda2) * self.__mult
|
||||
#######################################################
|
||||
sv_nb = sv_nb // self.__turns
|
||||
first = sv_nb // 4
|
||||
@@ -1117,7 +1134,7 @@ class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
third = 3 * first
|
||||
fourth = sv_nb
|
||||
bb_len1 = self.__bb_len
|
||||
bb_len2 = 1 + (bb_len1 - 1) * sqrt(lambda1 / lambda2)
|
||||
bb_len2 = 1 + (bb_len1 - 1) * math.sqrt(lambda1 / lambda2)
|
||||
p_first = p_mean - e1 - e2 * bb_len2
|
||||
p_second = p_mean - e1 * bb_len1 + e2
|
||||
p_third = p_mean + e1 + e2 * bb_len2
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : sketchy_multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Builds sketchy strokes whose topology relies on a
|
||||
# parameterization that covers the complete lines (visible+invisible)
|
||||
# whereas only the visible portions are actually drawn
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,27 +11,33 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : sketchy_multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Builds sketchy strokes whose topology relies on a
|
||||
# parameterization that covers the complete lines (visible+invisible)
|
||||
# whereas only the visible portions are actually drawn
|
||||
|
||||
from ChainingIterators import pySketchyChainSilhouetteIterator
|
||||
from Freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \
|
||||
TextureAssignerShader, TrueUP1D
|
||||
from shaders import pyHLRShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## 0: don't restrict to selection
|
||||
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3,0))
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
SpatialNoiseShader(15, 120, 2, True, True),
|
||||
IncreasingThicknessShader(5, 30),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(0,0.2,0,1,0.2,0.7,0.2,1),
|
||||
TextureAssignerShader(6),
|
||||
pyHLRShader()
|
||||
]
|
||||
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, False))
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
SpatialNoiseShader(15, 120, 2, True, True),
|
||||
IncreasingThicknessShader(5, 30),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(0, 0.2, 0, 1, 0.2, 0.7, 0.2, 1),
|
||||
TextureAssignerShader(6),
|
||||
pyHLRShader(),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : sketchy_topology_broken.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is, first, built
|
||||
# independantly from the 3D topology of objects,
|
||||
# and, second, so as to chain several times the same ViewEdge.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,15 +11,23 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
# Filename : sketchy_topology_broken.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is, first, built
|
||||
# independantly from the 3D topology of objects,
|
||||
# and, second, so as to chain several times the same ViewEdge.
|
||||
|
||||
from ChainingIterators import pySketchyChainingIterator
|
||||
from Freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \
|
||||
TextureAssignerShader, TrueUP1D
|
||||
from shaders import pyBackboneStretcherNoCuspShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## Chain 3 times each ViewEdge indpendantly from the
|
||||
@@ -38,13 +35,13 @@ Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(pySketchyChainingIterator(3))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(6, 120, 2, True, True),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SpatialNoiseShader(6, 120, 2, True, True),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||
pyBackboneStretcherNoCuspShader(20),
|
||||
#ConstantColorShader(0.0,0.0,0.0)
|
||||
IncreasingColorShader(0.2,0.2,0.2,1,0.5,0.5,0.5,1),
|
||||
#IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
#ConstantColorShader(0.0, 0.0, 0.0)
|
||||
IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1),
|
||||
#IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : sketchy_topology_preserved.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is built
|
||||
# so as to chain several times the same ViewEdge.
|
||||
# The topology of the objects is preserved
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,28 +11,32 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : sketchy_topology_preserved.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is built
|
||||
# so as to chain several times the same ViewEdge.
|
||||
# The topology of the objects is preserved
|
||||
|
||||
from ChainingIterators import pySketchyChainSilhouetteIterator
|
||||
from Freestyle import ConstantColorShader, IncreasingThicknessShader, Operators, \
|
||||
QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \
|
||||
TextureAssignerShader, TrueUP1D
|
||||
|
||||
upred = QuantitativeInvisibilityUP1D(0)
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3,1))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(20, 220, 2, True, True),
|
||||
IncreasingThicknessShader(4, 8),
|
||||
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
|
||||
ConstantColorShader(0.6,0.2,0.0),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
|
||||
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, True))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(20, 220, 2, True, True),
|
||||
IncreasingThicknessShader(4, 8),
|
||||
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
|
||||
ConstantColorShader(0.6, 0.2, 0.0),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
|
@@ -1,14 +1,4 @@
|
||||
#
|
||||
# Filename : split_at_highest_2d_curvature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,21 +11,31 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesU1D import *
|
||||
from Functions0D import *
|
||||
# Filename : split_at_highest_2d_curvature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D
|
||||
from Functions0D import pyInverseCurvature2DAngleF0D
|
||||
from PredicatesU0D import pyParameterUP0D
|
||||
from PredicatesU1D import pyHigherLengthUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
func = pyInverseCurvature2DAngleF0D()
|
||||
Operators.recursive_split(func, pyParameterUP0D(0.4,0.6), NotUP1D(pyHigherLengthUP1D(100)), 2)
|
||||
shaders_list = [ConstantThicknessShader(10), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
|
||||
Operators.recursive_split(func, pyParameterUP0D(0.4, 0.6), NotUP1D(pyHigherLengthUP1D(100)), 2)
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(10),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(3),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : split_at_tvertices.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws strokes that starts and stops at Tvertices (visible or not)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,23 +11,30 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from Functions0D import *
|
||||
# Filename : split_at_tvertices.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws strokes that starts and stops at Tvertices (visible or not)
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \
|
||||
Nature, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D
|
||||
from PredicatesU0D import pyVertexNatureUP0D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
start = pyVertexNatureUP0D(Nature.T_VERTEX)
|
||||
## use the same predicate to decide where to start and where to stop
|
||||
## use the same predicate to decide where to start and where to stop
|
||||
## the strokes:
|
||||
Operators.sequential_split(start, start, 10)
|
||||
shaders_list = [ConstantThicknessShader(5), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5),
|
||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||
TextureAssignerShader(3),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : stroke_texture.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws textured strokes (illustrate the StrokeTextureShader shader)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,24 +11,28 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
from ChainingIterators import *
|
||||
# Filename : stroke_texture.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws textured strokes (illustrate the StrokeTextureShader shader)
|
||||
|
||||
from Freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \
|
||||
ConstantThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \
|
||||
Stroke, StrokeTextureShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(3),
|
||||
BezierCurveShader(4),
|
||||
StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, True),
|
||||
ConstantThicknessShader(40),
|
||||
ConstantColorShader(0,0,0,1),
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(3),
|
||||
BezierCurveShader(4),
|
||||
StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, True),
|
||||
ConstantThicknessShader(40),
|
||||
ConstantColorShader(0, 0, 0, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,15 +1,4 @@
|
||||
#
|
||||
# Filename : suggestive.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the suggestive contours.
|
||||
# ***** The suggestive contours must be enabled
|
||||
# in the options dialog *****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,22 +11,28 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
# Filename : suggestive.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the suggestive contours.
|
||||
# ***** The suggestive contours must be enabled
|
||||
# in the options dialog *****
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \
|
||||
Nature, Operators, QuantitativeInvisibilityUP1D, TrueUP1D
|
||||
from PredicatesU1D import pyNatureUP1D
|
||||
from logical_operators import AndUP1D, NotUP1D
|
||||
|
||||
upred = AndUP1D(pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR), QuantitativeInvisibilityUP1D(0))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(1, 3),
|
||||
ConstantColorShader(0.2,0.2,0.2, 1)
|
||||
]
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(1, 3),
|
||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : thickness_fof_depth_discontinuity.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Assigns to strokes a thickness that depends on the depth discontinuity
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,21 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from shaders import *
|
||||
# Filename : thickness_fof_depth_discontinuity.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Assigns to strokes a thickness that depends on the depth discontinuity
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import pyDepthDiscontinuityThicknessShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(1),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0),
|
||||
pyDepthDiscontinuityThicknessShader(0.8, 6)
|
||||
pyDepthDiscontinuityThicknessShader(0.8, 6),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : tipremover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes strokes extremities
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,23 +11,26 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : tipremover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes strokes extremities
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0,0,0),
|
||||
TipRemoverShader(20)
|
||||
]
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0, 0, 0),
|
||||
TipRemoverShader(20),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,13 +1,4 @@
|
||||
#
|
||||
# Filename : tvertex_remover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes TVertices
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,23 +11,27 @@
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# Filename : tvertex_remover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes TVertices
|
||||
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D
|
||||
from logical_operators import NotUP1D
|
||||
from shaders import pyTVertexRemoverShader
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
ConstantColorShader(0.2,0.2,0.2, 1),
|
||||
SamplingShader(10.0),
|
||||
pyTVertexRemoverShader()
|
||||
]
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||
SamplingShader(10.0),
|
||||
pyTVertexRemoverShader(),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
@@ -1,22 +1,35 @@
|
||||
from freestyle_init import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from Functions1D import *
|
||||
from shaders import *
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
from Freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \
|
||||
Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader
|
||||
from PredicatesB1D import pyZBP1D
|
||||
from PredicatesU1D import pyDensityUP1D
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user