1
// Wild Magic Source Code
3
// http://www.geometrictools.com
4
// Copyright (c) 1998-2007
6
// This library is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License as published by
8
// the Free Software Foundation; either version 2.1 of the License, or (at
9
// your option) any later version. The license is available for reading at
10
// either of the locations:
11
// http://www.gnu.org/copyleft/lgpl.html
12
// http://www.geometrictools.com/License/WildMagicLicense.pdf
13
// The license applies to versions 0 through 4 of Wild Magic.
15
// Version: 4.0.0 (2006/06/28)
20
#include "Wm4FoundationLIB.h"
21
#include "Wm4Vector2.h"
30
// Construction and destruction. The value of epsilon is used as a
31
// relative error when computing the dimension of the point set.
32
Mapper2 (int iVQuantity, const Vector2<Real>* akVertex, Real fEpsilon);
35
// Axis-aligned bounding box of the input points.
36
const Vector2<Real>& GetMin () const;
37
const Vector2<Real>& GetMax () const;
38
Real GetMaxRange () const;
40
// Dimension d of the set (0, 1, or 2).
41
int GetDimension () const;
43
// Coordinate system. The origin is valid for any dimension d. The
44
// unit-length direction vector is valid only for 0 <= i < d. The extreme
45
// index is relative to the array of input points, and is also valid only
46
// for 0 <= i < d. If d = 0, all points are effectively the same, but the
47
// use of an epsilon may lead to an extreme index that is not zero. If
48
// d = 1, all points effectively lie on a line segment. The extreme
49
// indices correspond to input points that are the end points of the
50
// segment. If d = 2, the first two extreme indices correspond to a
51
// line segment. The next extreme index corresponds to the input point
52
// that is farthest from this line segment in the direction perpendicular
54
const Vector2<Real>& GetOrigin () const;
55
const Vector2<Real>& GetDirection (int i) const;
56
int GetExtremeIndex (int i) const;
58
// If d = 2, the direction vectors {U0,U1} form a right-handed set. The
59
// three extreme points form a triangle. This function indicates if that
60
// triangle is counterclockwise ordered.
61
bool GetExtremeCCW () const;
64
// Axis-aligned bounding box of input points. The maximum range is the
65
// larger of max[0]-min[0] and max[1]-min[1].
66
Vector2<Real> m_kMin, m_kMax;
69
// The intrinsic dimension of the input set. The parameter fEpsilon to
70
// the constructor is used to provide a tolerance when determining the
74
// The indices that define the maximum dimensional extents. The values
75
// m_aiExtreme[0] and m_aiExtreme[1] are the indices for the vertices
76
// which define the largest extent in one of the coordinate axis
77
// directions. If the intrinsic dimensionality is 2, then m_aiExtreme[2]
78
// is the index for the vertex which causes the largest extent in the
79
// direction perpendicular to the line through the vertices corresponding
80
// to m_aiExtreme[0] and m_aiExtreme[1]. The triangle
81
// <V[extreme0],V[extreme1],V[extreme2]> can be clockwise or
82
// counterclockwise, the condition stored in m_bExtremeCCW.
86
// See the comments describing the member functions which return these
88
Vector2<Real> m_kOrigin;
89
Vector2<Real> m_akDirection[2];
92
#include "Wm4Mapper2.inl"
94
typedef Mapper2<float> Mapper2f;
95
typedef Mapper2<double> Mapper2d;