Branch data Line data Source code
1 : : /*
2 : : * AF2PlaneProjection.hpp
3 : : *
4 : : * A transformation between 2-dimensional space and 3-dimensional space
5 : : * that transforms from three dimensions to two dimensions by subtracting
6 : : * some origin point from the 3-dimensional point and removing the
7 : : * component that is in the direction normal to the plane. In other words,
8 : : * the transformation projects the 3-dimensional point onto a plane.
9 : : * After the projection, the point is scaled in the plane.
10 : : *
11 : : * The inverse works by first reversing the scaling, and then firing a
12 : : * ray from the plane in the direction normal to the plane and finding
13 : : * the intersection of the ray with the surface.
14 : : */
15 : :
16 : : #ifndef AF2PLANEPROJECTION_HPP
17 : : #define AF2PLANEPROJECTION_HPP
18 : :
19 : : // MeshKit
20 : : #include "meshkit/iGeom.hpp"
21 : : #include "meshkit/AF2LocalTransform.hpp"
22 : : #include "meshkit/Matrix.hpp"
23 : :
24 [ - + ]: 292 : class AF2PlaneProjection : public AF2LocalTransform
25 : : {
26 : : private:
27 : :
28 : : iGeom* iGeomPtr;
29 : : iGeom::EntityHandle surface;
30 : : MeshKit::Vector<3> pOrigin;
31 : : MeshKit::Vector<3> pNormal;
32 : : MeshKit::Vector<3> pXDir;
33 : : MeshKit::Vector<3> pYDir;
34 : : double scale;
35 : :
36 : : public:
37 : :
38 : : /**
39 : : * \brief Constructor
40 : : *
41 : : * It is the responsibility of the context that constructs/uses an
42 : : * AF2PlaneProjection to ensure that the pointer to the iGeom instance
43 : : * and the handle to the geometric surface remain valid as long as
44 : : * the AF2PlaneProjection is in use.
45 : : *
46 : : * The normal vector must have length bounded away from zero. Ideally
47 : : * it would have length one, but the constructor will normalize it
48 : : * to have length one if it does not.
49 : : *
50 : : * The x-direction vector must also have length bounded away from zero.
51 : : * Ideally it would have length one, but the constructor will normalize it
52 : : * to have length one if it does not. The x-direction vector must be
53 : : * orthogonal to the normal vector.
54 : : *
55 : : * The y-direction of the transformation will be defined such that
56 : : * the right hand rule is followed. In other words, the normal vector
57 : : * to the plane will be the standard right-handed cross product of the
58 : : * (normalized) x-direction vector and the y-direction.
59 : : *
60 : : * After projecting three-dimensional points into the plane, the
61 : : * coordinates will be multiplied by the inverse of the scaling factor.
62 : : * When used for the advancing front algorithm implementation, the
63 : : * scale should be given as the approximate distance between two
64 : : * adjacent points on the front near the baseline edge, since this
65 : : * will produce points that are nearly unit distance apart after
66 : : * the transformation is applied and the advancing front rules are
67 : : * defined relative to a unit length baseline edge.
68 : : *
69 : : * \param iGeomPtrArg a pointer to an iGeom instance
70 : : * \param srfcHandle a handle to a 2-dimensional surface embedded in
71 : : * 3-dimensional space that is a valid handle to access the surface
72 : : * through the iGeom instance referenced by iGeomPtrArg
73 : : * \param planeOrigin a point within the plane onto which this
74 : : * transformation will project points
75 : : * \param planeNormal a direction vector that is normal to the plane
76 : : * onto which this transformation will project points
77 : : * \param planeXDir a direction vector (parallel to the plane onto which
78 : : * this transformation will project points) that defines the direction
79 : : * that will be the first coordinate of the 2-dimensional space
80 : : * \param scaleFactor a positive scaling factor that approximates
81 : : * the distance between adjacent points on the advancing front
82 : : */
83 : : AF2PlaneProjection(iGeom* iGeomPtrArg,
84 : : iGeom::EntityHandle srfcHandle,
85 : : MeshKit::Vector<3> const & planeOrigin,
86 : : MeshKit::Vector<3> const & planeNormal,
87 : : MeshKit::Vector<3> const & planeXDir,
88 : : double scaleFactor);
89 : :
90 : : AF2Point2D* transformFromSurface(AF2Point3D const & srfcPnt, bool & legal) const;
91 : :
92 : : AF2Point3D* transformToSurface(AF2Point2D const & planePnt,
93 : : unsigned long const & pntId) const;
94 : : };
95 : :
96 : : #endif
|