00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Michiel Hagedoorn 00008 * Side Effects Software Inc. 00009 * 477 Richmond Street West, Suite 1001 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * This module contains algorithms for swept collision detection and resolution 00015 * for moving points and moving polygon soups. 00016 * Swept collision detection considers the linear trajectories of points 00017 * and polygons in a time interval. 00018 * The swept-collision approach guarantees that all collisions that 00019 * may occur within a time interval are detected. 00020 * (In contrast, static collision detection techniques only test 00021 * for penetrations and proximities at a fixed point in time, which allows 00022 * points to tunnel through polygons undetected.) 00023 * 00024 * This swept-collision code is used by DOPS, but it does not depend 00025 * on DOPS. For example, it does not know about SIM_Geometry or SIM_Object. 00026 * Therefore, it should be easy to re-use this code in another place, 00027 * for example POPs. 00028 */ 00029 00030 #ifndef __SIM_SweptCollision_h__ 00031 #define __SIM_SweptCollision_h__ 00032 00033 #include "SIM_API.h" 00034 #include "SIM_SweptCollisionData.h" 00035 #include <UT/UT_Vector3.h> 00036 #include <vector> 00037 00038 // The function SIMdetectAndResolveCollisions can be used 00039 // for one-way collision detection and collision resolution. 00040 // Only the positions of a are modified to avoid collisions. 00041 // 00042 // Given linear trajectories of a set of points a, and a set 00043 // of triangles b between times t_start and t_end, 00044 // find modified positions for a such that the trajectories 00045 // of a and b are collision free between t_start and t_end. 00046 // "Collision free" means that the points of a don't 00047 // intersect any of the triangles of b during a linear sweep 00048 // from t_start to t_end. 00049 // In addition, find a "projected" end velocity that 00050 // makes the time-derivatives of the contact distances 00051 // non-negative (as much as possible). 00052 extern bool SIM_API 00053 SIMdetectAndResolveCollisions( 00054 SIM_PositionPoints& position_points_a_resolved_end, 00055 SIM_VelocityPoints& velocity_points_a_resolved_end, 00056 const std::vector<fpreal>& thickness_points_a, 00057 const SIM_PositionPoints& position_points_a_start, 00058 const SIM_PositionPoints& position_points_a_end, 00059 const SIM_VelocityPoints& velocity_points_a_end, 00060 const SIM_TriangleConnectivity& triangles_b, 00061 const std::vector<fpreal>& thickness_points_b, 00062 const SIM_PositionPoints& position_points_b_start, 00063 const SIM_PositionPoints& position_points_b_end, 00064 const SIM_VelocityPoints& velocity_points_b_end, 00065 const fpreal t_start, 00066 const fpreal t_end 00067 ); 00068 00069 #endif
1.5.9