pathscatter.py revision 801127bca2d92350331d75f9c20e4b2e6a280259
131N/ACopyright (C) 2006 Jean-Francois Barraud, barraud@math.univ-lille1.fr 1835N/AThis program is free software; you can redistribute it and/or modify 131N/Ait under the terms of the GNU General Public License as published by 131N/Athe Free Software Foundation; either version 2 of the License, or 131N/A(at your option) any later version. 131N/AThis program is distributed in the hope that it will be useful, 131N/Abut WITHOUT ANY WARRANTY; without even the implied warranty of 131N/AMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 131N/AGNU General Public License for more details. 131N/AYou should have received a copy of the GNU General Public License 131N/Aalong with this program; if not, write to the Free Software 131N/AFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 131N/Abarraud@math.univ-lille1.fr 131N/AThis script deforms an object (the pattern) along other paths (skeletons)... 131N/AThe first selected object is the pattern 131N/Athe last selected ones are the skeletons. 131N/AImagine a straight horizontal line L in the middle of the bounding box of the pattern. 131N/AConsider the normal bundle of L: the collection of all the vertical lines meeting L. 131N/AConsider this as the initial state of the plane; in particular, think of the pattern 131N/Aas painted on these lines. 131N/ANow move and bend L to make it fit a skeleton, and see what happens to the normals: 131N/Athey move and rotate, deforming the pattern. 131N/A This function recieves a component of a 'cubicsuperpath' and returns two things: 131N/A The path subdivided in many straight segments, and an array containing the length of each segment. 131N/A We could work with bezier path as well, but bezier arc lengths are (re)computed for each point 131N/A in the deformed object. For complex paths, this might take a while. 131N/A help=
"choose between wave or snake effect")
131N/A help=
"repeat the path to fit deformer's length")
131N/A help=
"duplicate pattern before deformation")
131N/A help=
"duplicate pattern before deformation")
131N/A ##first selected->pattern, all but first selected-> skeletons 131N/A #id = self.options.ids[-1] 131N/A #TODO: allow 4th option: duplicate the first copy and clone the next ones. 131N/A Recieves an arc length l, and returns the index of the segment in self.skelcomp 131N/A containing the coresponding point, to gether with the position of the point on this segment. 131N/A If the deformer is closed, do computations modulo the toal length. 131N/A recieves a length, and returns the coresponding point and tangent of self.skelcomp 131N/A if follow is set to false, returns only the translation 131N/A #!!!!>----> TODO: really test if path is closed! end point==start point is not enough! 131N/A #!!!--> should it be given an id? 131N/A #seems to work without this!?!