home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
- ADOBE SYSTEMS INCORPORATED
- Copyright 2002 Adobe Systems Incorporated
- All Rights Reserved
-
- NOTICE: Adobe permits you to use, modify, and distribute this
- file in accordance with the terms of the Adobe license agreement
- accompanying it. If you have received this file from a source
- other than Adobe, then your use, modification, or distribution
- of it requires the prior written permission of Adobe.
- ***************************************************************/
- /***************************************************************
- Author: Mary Obelnicki
- ***************************************************************/
-
- /***************************************************************
-
- This function takes the path <aPath> and recursively replaces the
- line segments in the path creating a fractal of the given depth.
-
- Arguments:
-
- aPath
- the path to turn into a fractal
- replaceFunction
- the function the specifies how to change a line segment
- in for a fractal. A <replaceFunction> must take specific arguments.
- <argument1>
- the path to edit
- <argument2>
- the index of the first knot of the line segment on the path
- <argument3>
- the index of the second knot of the line segment on the path
- <argument4>
- an array of the knots, the indexes of the knots
- will be the same in the path and the array. This argument is
- optional and used for optimization. getting the array of
- knots from the path can be very time consuming.
-
- depth
- how many times to recursively replace the path's line segments.
-
- ***************************************************************/
-
- /***************************************************************
- DO NOT EDIT BELOW THIS LINE
- ***************************************************************/
-
- function fractal(aPath, replaceFunction, depth)
- {
- //for each depth
- var curDepth = 0;
- for(curDepth = 0; curDepth < depth; curDepth++)
- {
- var theKnots = aPath.knots;
- var numOfKnots = theKnots.length;
- var curKnot;
-
- if (aPath.closed)
- curKnot = numOfKnots-1;
- else
- curKnot = numOfKnots-2;
- //for every line segment
-
- for( ; curKnot >= 0; curKnot--)
- {
- //call the function
- replaceFunction(aPath, curKnot, (curKnot+1)%numOfKnots, theKnots);
- }
- }
- }
-
-
-