Wm4Mapper3.h

Go to the documentation of this file.
00001 // Wild Magic Source Code
00002 // David Eberly
00003 // http://www.geometrictools.com
00004 // Copyright (c) 1998-2007
00005 //
00006 // This library is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation; either version 2.1 of the License, or (at
00009 // your option) any later version.  The license is available for reading at
00010 // either of the locations:
00011 //     http://www.gnu.org/copyleft/lgpl.html
00012 //     http://www.geometrictools.com/License/WildMagicLicense.pdf
00013 // The license applies to versions 0 through 4 of Wild Magic.
00014 //
00015 // Version: 4.0.0 (2006/06/28)
00016 
00017 #ifndef WM4MAPPER3_H
00018 #define WM4MAPPER3_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Vector3.h"
00022 
00023 namespace Wm4
00024 {
00025 
00026 template <class Real>
00027 class Mapper3
00028 {
00029 public:
00030     // Construction and destruction.  The value of epsilon is used as a
00031     // relative error when computing the dimension of the point set.
00032     Mapper3 (int iVQuantity, const Vector3<Real>* akVertex, Real fEpsilon);
00033     ~Mapper3 ();
00034 
00035     // Axis-aligned bounding box of the input points.
00036     const Vector3<Real>& GetMin () const;
00037     const Vector3<Real>& GetMax () const;
00038     Real GetMaxRange () const;
00039 
00040     // Dimension d of the set (0, 1, 2, or 3).
00041     int GetDimension () const;
00042 
00043     // Coordinate system.  The origin is valid for any dimension d.  The
00044     // unit-length direction vector is valid only for 0 <= i < d.  The extreme
00045     // index is relative to the array of input points, and is also valid only
00046     // for 0 <= i < d.  If d = 0, all points are effectively the same, but the
00047     // use of an epsilon may lead to an extreme index that is not zero.  If
00048     // d = 1, all points effectively lie on a line segment.  The extreme
00049     // indices correspond to input points that are the end points of the
00050     // segment.  If d = 2, the first two extreme indices correspond to a
00051     // line segment.  The next extreme index corresponds to the input point
00052     // that is farthest from this line segment in a direction perpendicular
00053     // to the segment.  If d = 3, the first three extreme indices correspond
00054     // to a triangle.  The next extreme index corresponds to the input point
00055     // that is farthest from this triangle in a direction perpendicular to
00056     // the triangle.
00057     const Vector3<Real>& GetOrigin () const;
00058     const Vector3<Real>& GetDirection (int i) const;
00059     int GetExtremeIndex (int i) const;
00060 
00061     // If d = 3, the direction vectors {U0,U1,U2} form a right-handed set.
00062     // The four extreme points form a tetrahedron.  This function indicates
00063     // if that tetrahedron is counterclockwise ordered.
00064     bool GetExtremeCCW () const;
00065 
00066 private:
00067     // Axis-aligned bounding box of input points.  The maximum range is the
00068     // larger of max[0]-min[0], max[1]-min[1], and max[2]-min[2].
00069     Vector3<Real> m_kMin, m_kMax;
00070     Real m_fMaxRange;
00071 
00072     // The intrinsic dimension of the input set.  The parameter fEpsilon to
00073     // the constructor is used to provide a tolerance when determining the
00074     // dimension.
00075     int m_iDimension;
00076 
00077     // The indices that define the maximum dimensional extents.  The values
00078     // m_aiExtreme[0] and m_aiExtreme[1] are the indices for the vertices
00079     // which define the largest extent in one of the coordinate axis
00080     // directions.  If the intrinsic dimensionality is 2, then m_aiExtreme[2]
00081     // is the index for the vertex which causes the largest extent in the
00082     // direction perpendicular to the line through the vertices corresponding
00083     // to m_aiExtreme[0] and m_aiExtreme[1].  Furthermore, if the intrinsic
00084     // dimensionality is 3, then m_aiExtreme[3] is the index for the vertex
00085     // which causes the largest extent in the direction perpendicular to the
00086     // triangle defined by the other extreme points.  The tetrahedron
00087     // <V[extreme0],V[extreme1],V[extreme2],V[extreme3]> can be clockwise or
00088     // counterclockwise, the condition stored in m_bExtremeCCW.
00089     int m_aiExtreme[4];
00090     bool m_bExtremeCCW;
00091 
00092     // See the comments describing the member functions which return these
00093     // values.
00094     Vector3<Real> m_kOrigin;
00095     Vector3<Real> m_akDirection[3];
00096 };
00097 
00098 } //namespace Wm4
00099 
00100 #include "Wm4Mapper3.inl"
00101 
00102 namespace Wm4
00103 {
00104 typedef Mapper3<float> Mapper3f;
00105 typedef Mapper3<double> Mapper3d;
00106 }
00107 
00108 #endif

Generated on Wed Nov 23 19:01:04 2011 for FreeCAD by  doxygen 1.6.1