Torque3D Documentation / _generateds / quadTransforms.h

quadTransforms.h

Engine/source/math/util/quadTransforms.h

More...

Classes:

class

This class does bilinear mapping of quadrilateral to a square.

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _QUADTOQUADTRANSFORMS_H_
25#define _QUADTOQUADTRANSFORMS_H_
26
27#ifndef _MPOINT2_H_
28#include "math/mPoint2.h"
29#endif
30#ifndef _MPOINT3_H_
31#include "math/mPoint3.h"
32#endif
33#ifndef _MMATRIX_H_
34#include "math/mMatrix.h"
35#endif
36
37// NOTE: The code in these classes originate from the Wild Magic Source Code
38// library by David Eberly and is used with permission.
39
40
41/// This class does bilinear mapping of quadrilateral to a square.
42class BiQuadToSqr
43{
44public:
45
46   /// Constructs the transform class from the quadrilateral
47   /// points in counter clockwise order.
48   BiQuadToSqr(   const Point2F &p00, 
49                  const Point2F &p10,
50                  const Point2F &p11, 
51                  const Point2F &p01 );
52
53   /// Transforms the point.
54   Point2F transform( const Point2F &p ) const;
55
56protected:
57
58   static F32 deviation( const Point2F &sp );
59
60   Point2F m_kP00, m_kB, m_kC, m_kD;
61
62   F32 m_fBC, m_fBD, m_fCD;
63
64};
65
66
67class BiSqrToQuad3D
68{
69public:
70
71   BiSqrToQuad3D( const Point3F &pnt00, 
72                  const Point3F &pnt10,
73                  const Point3F &pnt11, 
74                  const Point3F &pnt01 );
75
76   Point3F transform( const Point2F &pnt ) const;
77
78protected:
79
80   Point3F p00, p01, p10, p11;
81};
82
83#endif // _QUADTOQUADTRANSFORMS_H_
84