DirectedLine Functions 

DirectedLine Functions SupportThe Fractal Science Kit fractal generator DirectedLine functions are associated with the DirectedLine object: Object DirectedLine { Point : CisAngle } A DirectedLine object represents a line with a given direction. This allows us to identify points to the right of the line or the left of the line without ambiguity. To this end, a line is defined by a point and an angle. The right side of the line is determined by an observer standing on the point looking in the direction of the angle. Note that we maintain the Cis(angle) rather than the actual angle for performance reasons. A DirectedLine can also be defined by 2 points. In this case the observer stands on the 1^{st} point and looks to the 2^{nd} point to determine the left/right side. The following example illustrates how you would define a DirectedLine object using the object's constructor: DirectedLine d = DirectedLine(point, Cis(angle)) This example assigns a directed line to the variable d. The directed line is defined by the arguments: point and Cis(angle), passed to the constructor. Note that we maintain the Cis(angle) rather than the actual angle for performance reasons. To create a DirectedLine using the point and angle, use the following function: DirectedLine d = DirectedLine.Create(point, angle) DirectedLine.Create creates the directed line from the arguments point and angle. To create a DirectedLine using 2 points, use the following function: DirectedLine d = DirectedLine.CreateFromPoints(p1, p2) DirectedLine.CreateFromPoints creates the directed line from the points p1 and p2. Complex DirectedLine.DistanceTo(DirectedLine e, z) DirectedLine.DistanceTo returns the signed distance from the point z to the line e. The sign indicates which side of the line the point lies; i.e., distance < 0: z is to the right of the line You can use DirectedLine.DistanceTo to calculate the distance to the line or to determine on which side of a line a point lies. Complex DirectedLine.PointIndex(DirectedLine e[], count, z) Given an array of count lines e[] and a point z, DirectedLine.PointIndex returns an integer where the i^{th} bit in the binary representation of the integer is based on which side of e[i] the point z is on; i.e., the i^{th} bit is 1 if z is on the right of e[i], and the i^{th} bit is 0 if z is on or to the left of e[i]. Complex DirectedLine.ColorIndex(DirectedLine e[], count, symmetry, dihedral, maxIndex, z) Given an array of count lines e[] and a point z, DirectedLine.ColorIndex returns a color index based on the pattern given by the lines in e[]. symmetry is an integer used to impose Nway symmetry on the pattern, where N is the value of the argument symmetry. dihedral, if True, adds dihedral symmetry as well. maxIndex is used to limit the range of the returned index to 0 <= index < maxIndex. For the best results, maxIndex should not be a power of 2 (e.g., 2, 4, 8, 16). void DirectedLine.GenerateLines(DirectedLine e[], count, order) DirectedLine.GenerateLines generates a random set of count directed lines in e[]. The lines all intersect the unit circle and are chosen so some of them are parallel, or emanate from the same point, to reduce the randomness of the resulting set. The argument order is the maximum number of extra nonrandom lines generated for any given line. If order is 0, no extra lines are generated. If order is 2, at most 2 extra lines are generated for any given line. 
Copyright © 20042017 Hilbert, LLC 