Geometry Functions |
|
|
Geometry Functions SupportThe Fractal Science Kit fractal generator Geometry functions provide an assortment of functions, geometric in nature, used by several of the built-in instructions. Complex Geometry.ProjectPointOnLine(z, p0, p1) Geometry.ProjectPointOnLine projects z on the line formed by p0 and p1 and returns the resulting point. Geometry.DistanceToLine returns the distance from z to the line formed by the points p0 and p1. Geometry.RotatePointAboutPoint rotates z by angle radians about origin and returns the resulting point. Geometry.ReflectPointAboutLine returns the reflection of z in the line formed by the points p0 and p1. Geometry.ReflectPoint returns the reflection of z in the line through the origin, inclined angle radians relative to the X axis. Geometry.ScalePointAboutPoint scales z by factor about origin and returns the resulting point. Complex Geometry.Quadrant(z) Geometry.Quadrant returns the quadrant (as an integer from 1 to 4) into which z falls. void Geometry.BarycentricCoordinates(z, p1, p2, p3, byref
r1, byref r2, byref r3) Geometry.IsInsideTriangle returns True if z is inside triangle given by points (p1, p2, p3). Geometry.BarycentricCoordinates returns the barycentric coordinates of z with respect to the triangle given by points (p1, p2, p3). The barycentric coordinates are returned in the real numbers (r1, r2, r3). The following is true: z = r1*p1 + r2*p2 + r3*p3 For additional details see: Eric W. Weisstein. "Barycentric Coordinates." From MathWorld--A Wolfram Web Resource. Complex Geometry.RadialInversion(radius, z) Geometry.RadialInversion reflects z in a circle centered at the origin with the given radius. Geometry.Inversion reflects z in the circle with the given center and radius. Complex Geometry.MidPoint(p0, p1) Geometry.MidPoint returns the midpoint of the line segment defined by p0 and p1. Geometry.IntersectLines returns the point of intersection of the 2 lines formed by p0, p1 and q0, q1. Complex Geometry.AngleDifference(ang0, ang1) Geometry.AngleDifference returns the difference between the angles ang0 and ang1 given in radians. The resulting angle is greater than or equal to 0 and less than or equal to Math.PI. Geometry.AverageAngle, Geometry.AverageAngle3, and Geometry.AverageAngle4 return the average of the argument angles given in radians. These are not simply arithmetic averages due to the cyclic nature of angle measures. For example, the average of 355 degrees and 5 degrees is 0 degrees not 180 degrees. void Geometry.GeneratePointsOnCircle(points[], count,
center, radius, angle0) Geometry.GeneratePointsOnCircle fills the points[] array with count equally spaced points on the circle with the given center and radius. The 1st point is located on the circle angle0 radians counterclockwise from horizontal. Geometry.GenerateAngles fills the angles[] array with count equally spaced angles between angle0 and angle0+2*Math.PI. Geometry.GeneratePointsOnSegment fills the points[] array with count equally spaced points on the line segment between points p and q. void Geometry.PolygonSpin(points[], result[], count, rate) Geometry.PolygonSpin fills the result[] array with count points generated from the polygon defined by the count points in points[]. result[i] is set to the point P on the segment from points[i] to points[i+1] where P is rate of the way along the segment. You may pass the same array for points[] and result[] and this method will update the array in place. Both points[] and result[] are assumed to be large enough to hold count values. count should be 3 or more. void Geometry.TruncatePolygon(points[], result[], count, factor) Geometry.TruncatePolygon takes points[] as the count vertices of a polygon. factor is applied to each edge length to determine the distance of the 2 truncated points from the endpoints they replace. The array result[] is assumed to be large enough to hold 2*count values. factor should be between 0 and 0.5 exclusive but values outside this range produce interesting results too. count should be 3 or more. void Geometry.StellatePolygon(points[], result[], count, factor) Geometry.StellatePolygon takes points[] as the count vertices of a polygon. factor is applied to each edge length to determine the distance of the stellate point from the edge. The result[] array must be dimensioned 2*count to hold the resulting points. Technically, this is not the correct way to stellate a polygon but it produces nice results and is easy to do. count should be 3 or more. Complex Geometry.HexCellCenter(size, z) Geometry.HexCellCenter returns the center of the hexagon cell where z falls. size is the height of each hexagon cell. The reference hexagon is size tall by size*Sqrt(3)/2 wide and is centered at the origin with vertices on the left and right, and edges on the top and bottom. Complex Geometry.MagnitudeFactor(z) Geometry.MagnitudeFactor(z) returns a scale factor that can be used to scale orbit trap values based on the magnitude of z. This results in lines becoming wider as they move away from the origin. |
|
Copyright © 2004-2010 Hilbert, LLC |