KrisLibrary  1.0.0
LocalCoordinates3D.h
1 #ifndef MATH3D_LOCAL_COORDINATES3D_H
2 #define MATH3D_LOCAL_COORDINATES3D_H
3 
4 #include "Point.h"
5 
6 namespace Math3D {
7 
8 struct Line3D;
9 struct Segment3D;
10 struct Plane3D;
11 
12 //a rigid-body transformation
14 {
15  void getBasis (Matrix4&) const;
16  void getBasisInv (Matrix4&) const;
17  void getTransform (RigidTransform&) const;
18  void getTransformInv (RigidTransform&) const;
19  void toLocal (const Point3D&, Point3D&) const;
20  void toLocalReorient (const Vector3&, Vector3&) const;
21  void fromLocal (const Point3D&, Point3D&) const;
22  void fromLocalReorient(const Vector3&, Vector3&) const;
23 
24  void toLocal (const Line3D&, Line3D&) const;
25  void toLocal (const Segment3D&, Segment3D&) const;
26  void toLocal (const Plane3D&, Plane3D&) const;
27  void fromLocal (const Line3D&, Line3D&) const;
28  void fromLocal (const Segment3D&, Segment3D&) const;
29  void fromLocal (const Plane3D&, Plane3D&) const;
30 
31  bool Read(File& f);
32  bool Write(File& f) const;
33 
34  Vector3 origin;
35  Vector3 xbasis, ybasis, zbasis; //orthonormal vectors representing the orientation
36 };
37 
38 //a rigid-body transformation with a scale in each basis direction
39 //normalize -> from unscaled coordinates to scaled
40 //denormalize -> from scaled coordinates to unscaled
42 {
43  void getBasisScaled (Matrix4&) const;
44  void getBasisScaledInv (Matrix4&) const;
45  void normalize (const Vector3&, Vector3&) const;
46  void denormalize (const Vector3&, Vector3&) const;
47 
48  void toLocalNormalized (const Point3D&, Point3D&) const;
49  void toLocalNormalized (const Line3D&, Line3D&) const;
50  void toLocalNormalized (const Segment3D&, Segment3D&) const;
51  void toLocalNormalized (const Plane3D&, Plane3D&) const;
52  void fromLocalNormalized (const Point3D&, Point3D&) const;
53  void fromLocalNormalized (const Line3D&, Line3D&) const;
54  void fromLocalNormalized (const Segment3D&, Segment3D&) const;
55  void fromLocalNormalized (const Plane3D&, Plane3D&) const;
56 
57  bool Read(File& f);
58  bool Write(File& f) const;
59 
60  Vector3 dims;
61 };
62 
63 } //namespace Math3D
64 
65 #endif
A 3D plane classRepresents plane with a normal and offset such that x on the plane satisfy dot(normal...
Definition: Plane3D.h:19
A 3D vector class.
Definition: math3d/primitives.h:136
Definition: LocalCoordinates3D.h:41
A rigid-body transformation.
Definition: math3d/primitives.h:820
A 4x4 matrix class.
Definition: math3d/primitives.h:626
Definition: LocalCoordinates3D.h:13
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:12
A 3D line class.
Definition: Line3D.h:18
A cross-platform class for reading/writing binary data.
Definition: File.h:47
Definition: Segment3D.h:12