VR-Forces 4.0.4 Class Documentation
include/geometry/chordUtilities.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2005 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: chordUtilities.h,v $ $Revision: 1.6 $ $State: Exp $
00007 ******************************************************************************/
00008 #ifndef chordUtilities_H_
00009 #define chordUtilities_H_
00010 
00011 //
00012 // \file chordUtilities.h
00013 // \brief Contains utility functions for chords, such as intersection, distance from,
00014 // and the closest point to.
00015 //
00016 
00017 #include "geometry/geometryDefines.h"
00018 #include "geometry/point.h"
00019 
00020 class DtChord;
00021 
00022 
00023 // The DtChordIntersectionResult enum contains the different possible intersection
00024 // values between two chords.  
00025 typedef enum
00026 {
00027    DtNonParallelNonIntersecting = 0,
00028    DtNonParallelIntersecting,
00029    DtParallelOverlapping,
00030    DtParallelNonOverlapping,
00031    DtSameChord
00032 } DtChordIntersectionResult;
00033 
00034 
00035 // A helper function designed to turn the intersection result above into a 
00036 // simple bool when a simple yes/no intersection result is desired.
00037 DT_DLL_geometry bool DtChordsIntersect(DtChordIntersectionResult intersectionResult);
00038 
00039 // If two segments have an angle between them less than this value
00040 // they are treated as parallel.
00041 DT_DLL_geometry double theParallelAngle();
00042 
00043 
00044 // Calculate if the projections onto the x-y plane of another segment 
00045 // and this segment intersect.  
00046 DT_DLL_geometry DtChordIntersectionResult DtIntersectInXY(const DtChord& chord1, 
00047    const DtChord& chord2);
00048 DT_DLL_geometry DtChordIntersectionResult DtIntersectInXY(const DtPoint& chord1EndPoint0, 
00049    const DtPoint& chord1EndPoint1, const DtChord& chord2);
00050 DT_DLL_geometry DtChordIntersectionResult DtIntersectInXY(const DtChord& chord1, 
00051    const DtPoint& chord2EndPoint0, const DtPoint& chord2EndPoint1);
00052 DT_DLL_geometry DtChordIntersectionResult DtIntersectInXY(const DtPoint& chord1EndPoint0,
00053    const DtPoint& chord1EndPoint1, const DtPoint& chord2EndPoint0, const DtPoint& chord2EndPoint1);
00054 
00055 // Calculate if the projections onto the x-y plane of two chords, and see if the
00056 // projections intersect.  Calculate the closest point on each chord's 
00057 // projection to the other chord's projection.  If the two chords intersect, 
00058 // then the closest point is the intersection point.
00059 //
00060 // \param distanceSquared The distance between the two chords squared,
00061 // \param thisX/thisY hold the closest points on chord1
00062 // \param otherX/otherY hold the closest point on chord2.  
00063 DT_DLL_geometry DtChordIntersectionResult DtIntersectInXY(const DtChord& chord1, 
00064    const DtChord& chord2, double& distanceSquared, double& chord1X, double& chord1Y, 
00065    double& chord2X, double& chord2Y);
00066 
00067 
00068 DT_DLL_geometry double DtPointChordDistanceInXY(double pointX, double pointY,
00069                                 double end0X,  double end0Y,
00070                                 double end1X,  double end1Y);
00071 
00072 DT_DLL_geometry double DtPointChordDistanceInXY(double pointX, double pointY,
00073                                 double end0X,  double end0Y,
00074                                 double end1X,  double end1Y,
00075                                 double& outX,  double& outY);
00076 
00077 
00078 DT_DLL_geometry void DtClosestPoint(const DtChord& chord, const DtPoint& pointOfInterest, 
00079    DtPoint& closestPoint, double& distance);
00080 
00081 DT_DLL_geometry void DtClosestPoint(const DtPoint& chordEndPoint0, const DtPoint& chordEndPoint1,
00082    const DtPoint& pointOfInterest, DtPoint& closestPoint, double& distance);
00083 
00084 
00085 DT_DLL_geometry void DtClosestPointInXY(const DtChord& chord, const DtPoint& pointOfInterest, 
00086    DtPoint& closestPnt, double& distance);
00087 
00088 DT_DLL_geometry void DtClosestPointInXY(const DtPoint& chordEndPoint0, const DtPoint& chordEndPoint1,
00089    const DtPoint& pointOfInterest, DtPoint& closestPnt, double& distance);
00090 
00091 // Finds the closest approach between the two specified chords in 3D.
00092 // The points on each chord are passed back in chord1Point and chord2Point.
00093 // The time value (0 - 1.0) along each chord of the points are passed back
00094 // in chord1T and chord2T.
00095 // \return The square of the distance at the closest approach.
00096 DT_DLL_geometry double DtClosestApproachChordToChord(const DtChord& chord1,
00097                                                      const DtChord& chord2,
00098                                                      double& chord1T,
00099                                                      double& chord2T,
00100                                                      DtPoint& chord1Point,
00101                                                      DtPoint& chord2Point);
00102 
00103 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)