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