3 add3, sub3, neg3, div3, mul3, eqpt3, closept3, dot3, cross3, len3, dist3, unit3, midpt3, lerp3, reflect3, nearseg3, pldist3, vdiv3, vrem3, pn2f3, ppp2f3, fff2p3, pdiv4, add4, sub4 \- operations on 3-d points and planes
13 Point3 add3(Point3 a, Point3 b)
16 Point3 sub3(Point3 a, Point3 b)
22 Point3 div3(Point3 a, double b)
25 Point3 mul3(Point3 a, double b)
28 int eqpt3(Point3 p, Point3 q)
31 int closept3(Point3 p, Point3 q, double eps)
34 double dot3(Point3 p, Point3 q)
37 Point3 cross3(Point3 p, Point3 q)
43 double dist3(Point3 p, Point3 q)
46 Point3 unit3(Point3 p)
49 Point3 midpt3(Point3 p, Point3 q)
52 Point3 lerp3(Point3 p, Point3 q, double alpha)
55 Point3 reflect3(Point3 p, Point3 p0, Point3 p1)
58 Point3 nearseg3(Point3 p0, Point3 p1, Point3 testp)
61 double pldist3(Point3 p, Point3 p0, Point3 p1)
64 double vdiv3(Point3 a, Point3 b)
67 Point3 vrem3(Point3 a, Point3 b)
70 Point3 pn2f3(Point3 p, Point3 n)
73 Point3 ppp2f3(Point3 p0, Point3 p1, Point3 p2)
76 Point3 fff2p3(Point3 f0, Point3 f1, Point3 f2)
79 Point3 pdiv4(Point3 a)
82 Point3 add4(Point3 a, Point3 b)
85 Point3 sub4(Point3 a, Point3 b)
87 These routines do arithmetic on points and planes in affine or projective 3-space.
94 typedef struct Point3 Point3;
100 Routines whose names end in
102 operate on vectors or ordinary points in affine 3-space, represented by their Euclidean
107 in their arguments, and set
116 Add the coordinates of two points.
119 Subtract coordinates of two points.
122 Negate the coordinates of a point.
125 Multiply coordinates by a scalar.
128 Divide coordinates by a scalar.
131 Test two points for exact equality.
134 Is the distance between two points smaller than
144 Distance to the origin.
147 Distance between two points.
150 A unit vector parallel to
154 The midpoint of line segment
158 Linear interpolation between
164 The reflection of point
166 in the segment joining
184 Vector divide \(em the length of the component of
188 in units of the length of
192 Vector remainder \(em the component of
196 Ignoring roundoff, we have
197 .BR "eqpt3(add3(mul3(b, vdiv3(a, b)), vrem3(a, b)), a)" .
200 The following routines convert amongst various representations of points
201 and planes. Planes are represented identically to points, by duality;
207 .BR p.x*q.x+p.y*q.y+p.z*q.z+p.w*q.w=0 .
208 Although when dealing with affine points we assume
210 we can't make the same assumption for planes.
211 The names of these routines are extra-cryptic. They contain an
213 (for `face') to indicate a plane,
220 abbreviates the word `to.'
223 reminds us, as before, that we're dealing with affine points.
226 takes a point and a normal vector and returns the corresponding plane.
233 Compute the plane passing through
239 Compute the plane passing through three points.
242 Compute the intersection point of three planes.
245 The names of the following routines end in
247 because they operate on points in projective 4-space,
248 represented by their homogeneous coordinates.
251 Perspective division. Divide
255 coordinates, converting to affine coordinates.
258 is zero, the result is the same as the argument.
261 Add the coordinates of two points.
265 Subtract the coordinates of two points.
267 .B \*9/src/libgeometry