ControlPoint.cpp

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 
00012 #include "ControlPoint.h"
00013 
00014 namespace Track
00015 {
00016 
00017 namespace EditAssist
00018 {
00019 
00020 bool ControlPoint::is_here(btVector3 start, btVector3 stop, btScalar radius) const
00021 {
00022     btVector3 line = stop - start;
00023     btVector3 to_start = position - start;
00024     btScalar u = to_start.dot(line) / line.length2();
00025     // Is it behind or infront of visible depth range?
00026     if (u < 0.0 || u > 1.0)
00027     {
00028         return false;
00029     }
00030     btScalar distance2 = (u * line).distance2(to_start);
00031     if (distance2 < radius * radius)
00032     {
00033         return true;
00034     }
00035     return false;
00036 }
00037     
00038 const btVector3 & ControlPoint::get_position() const
00039 {
00040     return position;
00041 }
00042 
00043 void ControlPoint::set_position(const btVector3 & new_position)
00044 {
00045     position = new_position;
00046 }
00047 
00048 }
00049 
00050 }
00051 

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.