True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

Geometry.h

00001 //---------------------------------------------------------------------------------
00002 // File Name: Geometry.h
00003 // Description: Misc geometric functions
00004 //
00005 // Copyright (C) 2004 - 2006 True Axis Pty Ltd, Australia. 
00006 // All Rights Reserved.
00007 //
00008 // History:
00009 //      Created File.
00010 //---------------------------------------------------------------------------------
00011 
00012 #ifndef TA_GEOMETRY_H
00013 #define TA_GEOMETRY_H
00014 
00015 #ifndef TA_COMMON_H
00016 #include "Common.h"
00017 #endif // TA_COMMON_H
00018 
00019 TA_OBFUSCATION_SKIP_PASS_2
00020 
00021 namespace TA
00022 {
00023 
00024 struct Vec2;
00025 struct Vec3;
00026 
00027 TA_OBFUSCATION_RESERVED_ON
00028 
00029 class TACOMMON_CLASS Geometry
00030 {
00031 public:
00032     //---------------------------------------------------------------------------------
00033     // Returns: true if the line intersects the box
00034     //---------------------------------------------------------------------------------
00035     static bool TAC_CALL LineIntersectsBox(
00036         const Vec2& v2A,            // Line start
00037         const Vec2& v2B,            // Line end
00038         const Vec2& v2Center,       // Box center
00039         const Vec2& v2Extent);      // Box extents
00040 
00041     //---------------------------------------------------------------------------------
00042     //---------------------------------------------------------------------------------
00043     static float TAC_CALL CubicInterpolate(float fPosA, float fPosB, float fVelA, float fVelB, float fTime);
00044 
00045     //---------------------------------------------------------------------------------
00046     //---------------------------------------------------------------------------------
00047     static Vec3 TAC_CALL CubicInterpolate(const Vec3& v3PosA, const Vec3& v3PosB, const Vec3& v3VelA, const Vec3& v3VelB, float fTime);
00048 
00049     //---------------------------------------------------------------------------------
00050     //---------------------------------------------------------------------------------
00051     static float TAC_CALL CubicInterpolateGradient(float fPosA, float fPosB, float fVelA, float fVelB, float fTime);
00052 
00053     //---------------------------------------------------------------------------------
00054     //---------------------------------------------------------------------------------
00055     static bool TAC_CALL Geometry::TestEdgeMovementAgainstEdge(
00056         const Vec3& v3A0,
00057         const Vec3& v3A1,
00058         const Vec3& v3B0,
00059         const Vec3& v3B1,
00060         const Vec3& v3C0,
00061         const Vec3& v3C1,
00062         float& fResultTime,
00063         Vec3& v3ResultPos,
00064         Vec3& v3ResultNormal);
00065     
00066     //---------------------------------------------------------------------------------
00067     //---------------------------------------------------------------------------------
00068     static bool TAC_CALL Geometry::TestLineMovementAgainstCapsule(
00069         const Vec3& v3A0,
00070         const Vec3& v3A1,
00071         const Vec3& v3B0,
00072         const Vec3& v3B1,
00073         const Vec3& v3C0,
00074         const Vec3& v3C1,
00075         float fRadius,
00076         float& fResultTime,
00077         Vec3& v3ResultPos,
00078         Vec3& v3ResultNormal);
00079 
00080     //---------------------------------------------------------------------------------
00081     //---------------------------------------------------------------------------------
00082     static void TAC_CALL Geometry::FindClosestPointOnLineToLine(
00083         const Vec3& v3A0,
00084         const Vec3& v3A1,
00085         const Vec3& v3B0,
00086         const Vec3& v3B1,
00087         Vec3& v3ResultPosOnA,
00088         Vec3& v3ResultPosOnB);
00089     
00090     //---------------------------------------------------------------------------------
00091     // returns false if the closet point between to lines is not on the line segments.
00092     //---------------------------------------------------------------------------------
00093     static bool TAC_CALL Geometry::FindClosestPointOnLineToLineUnClamped(
00094         const Vec3& v3A0,
00095         const Vec3& v3A1,
00096         const Vec3& v3B0,
00097         const Vec3& v3B1,
00098         Vec3& v3ResultPosOnA,
00099         Vec3& v3ResultPosOnB);
00100 
00101     //---------------------------------------------------------------------------------
00102     //---------------------------------------------------------------------------------
00103     static bool TAC_CALL Geometry::TestPointMovementAgainstSphere(
00104         const Vec3& v3A0,
00105         const Vec3& v3A1,
00106         const Vec3& v3B,
00107         float fRadius,
00108         float& fResultTime,
00109         Vec3& v3ResultPos,
00110         Vec3& v3ResultNormal);
00111 
00112     //---------------------------------------------------------------------------------
00113     //---------------------------------------------------------------------------------
00114     static bool TAC_CALL Geometry::TestSphereMovementAgainstLine(
00115         const Vec3& v3A0,
00116         const Vec3& v3A1,
00117         const Vec3& v3B0,
00118         const Vec3& v3B1,
00119         float fRadius,
00120         float& fResultTime,
00121         Vec3& v3ResultPos,
00122         Vec3& v3ResultNormal);
00123 
00124     //---------------------------------------------------------------------------------
00125     //---------------------------------------------------------------------------------
00126     static bool TAC_CALL Geometry::TestLineMovementAgainstSphere(
00127         const Vec3& v3A0,
00128         const Vec3& v3A1,
00129         const Vec3& v3B0,
00130         const Vec3& v3B1,
00131         const Vec3& v3C,
00132         float fRadius,
00133         float& fResultTime,
00134         Vec3& v3ResultPos,
00135         Vec3& v3ResultNormal);
00136 
00137     //---------------------------------------------------------------------------------
00138     //---------------------------------------------------------------------------------
00139     static Vec3 TAC_CALL Geometry::FindClosestPointOnLine(
00140         const Vec3& v3Point,
00141         const Vec3& v3LineA,
00142         const Vec3& v3LineB);
00143 
00144     //---------------------------------------------------------------------------------
00145     //---------------------------------------------------------------------------------
00146     static float TAC_CALL Geometry::FindShortestDistanceToLineSqrd(
00147         const Vec3& v3Point,
00148         const Vec3& v3LineA,
00149         const Vec3& v3LineB);
00150 
00151     //---------------------------------------------------------------------------------
00152     //---------------------------------------------------------------------------------
00153     static float TAC_CALL Geometry::FindShortestDistanceToLine(
00154         const Vec3& v3Point,
00155         const Vec3& v3LineA,
00156         const Vec3& v3LineB);
00157 
00158     //---------------------------------------------------------------------------------
00159     //---------------------------------------------------------------------------------
00160     static bool TAC_CALL Geometry::FindClosestPointOnLineUnClamped(
00161         const Vec3& v3Point,
00162         const Vec3& v3LineA,
00163         const Vec3& v3LineB,
00164         Vec3& v3ResultPos); 
00165 
00166     //---------------------------------------------------------------------------------
00167     //---------------------------------------------------------------------------------
00168     static bool TAC_CALL Geometry::TestPointAgainstCone(
00169         const Vec3& v3Point,
00170         const Vec3& v3LineA,
00171         const Vec3& v3LineB,
00172         float fRadius);
00173 TA_OBFUSCATION_RESERVED_OFF
00174 };
00175 
00176 };
00177 
00178 #endif // TA_GEOMETRY_H


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.