![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 00006 #pragma once 00007 00008 #include "geometry/geometryDefines.h" 00009 00010 class DtExtent; 00011 class DtPoint; 00012 class DtDcm; 00013 class Dt3dBoundingVolume; 00014 class DtSphere; 00015 class DtVector; 00016 class DtChord; 00017 00018 // Expand the specified extent to include the extent created by the radius and 00019 // specified local position. 00020 // @param extent The extent to expand. 00021 // @param localPosition The position of the new extent. 00022 // @param halfLength The half-length of the heigh/width/length of the cube extent, 00023 // of the new extent. The new extent is a @b cube, 00024 // and so the length = width = height. 00025 // 00026 // @note This is commonly used to create an extent from a bounding sphere, which 00027 // is why the radius is really the half-width/length/height and why those are 00028 // all equal to each other (cube). 00029 DT_DLL_geometry void DtExpandExtentToIncludeBoundingShere(DtExtent& extent, 00030 const DtPoint& localPosition, 00031 double halfLength); 00032 00033 // Expand the specified extent to include the extent created by the radius and 00034 // specified local position. 00035 // 00036 // @param extent The extent to expand 00037 // @param localBoundingVolume The local bounding volume to place and orient, and 00038 // then expand the specified extent by. 00039 // @param worldOrientation The world orientation transformation for the bounding volume. 00040 // @param worldLocation The location, in the world, of the bounding volume. 00041 // 00042 DT_DLL_geometry void DtExpandExtentToIncludeBoundingVolume(DtExtent& extent, 00043 const Dt3dBoundingVolume& localBoundingVolume, 00044 const DtDcm& worldOrientation, 00045 const DtPoint& worldLocation); 00046 00047 // \return The point on the triangle defined by triangleA, triangleB, triangleC 00048 // which is closest to testPoint. 00049 DT_DLL_geometry DtPoint DtClosestPointOnTriangleTo(const DtPoint& testPoint, 00050 const DtPoint& triangleA, 00051 const DtPoint& triangleB, 00052 const DtPoint& triangleC); 00053 00054 // Tests the intersection of a ray with a sphere. 00055 // \return True only if they intersect. 00056 // If they do intersect, t will have the distance along the ray (in meters) 00057 // where the intersection occurs, and intersectPoint will be the point of 00058 // intersection. If a chord is specified, the chord will contain the segment 00059 // through the sphere where the ray intersects. 00060 DT_DLL_geometry bool DtIntersectRaySphere(const DtPoint& rayStartPoint, 00061 const DtVector& rayDirection, 00062 const DtSphere& sphere, 00063 double& t, DtPoint& intersectPoint); 00064 00065 DT_DLL_geometry bool DtIntersectRaySphere(const DtPoint& rayStartPoint, 00066 const DtVector& rayDirection, 00067 const DtSphere& sphere, 00068 double& t, DtPoint& intersectPoint, 00069 DtChord& segmentThroughSphere); 00070 00071 00072 // Returns the bounding radius for a given boundingVolume, in the 00073 // bounding volume's X-Y plane only (takes into account length and 00074 // width only -- ignores height). 00075 DT_DLL_geometry double DtBoundingRadiusInXY(const Dt3dBoundingVolume& boundingVolume); 00076 00077 // Same as DtBoundingRadiusInXY(), but it returns the square of the value. 00078 // Faster than DtBoundingRadiusInXY(). 00079 DT_DLL_geometry double DtBoundingRadiusInXYSquared(const Dt3dBoundingVolume& boundingVolume); 00080 00081