All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends

taylor_vector.h

00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00037 #ifndef FCL_TAYLOR_VECTOR_H
00038 #define FCL_TAYLOR_VECTOR_H
00039 
00040 #include "fcl/ccd/interval_vector.h"
00041 #include "fcl/ccd/taylor_model.h"
00042 
00043 namespace fcl
00044 {
00045 
00046 struct TVector3
00047 {
00048   TaylorModel i_[3];
00049 
00050   TVector3();
00051   TVector3(const boost::shared_ptr<TimeInterval>& time_interval);
00052   TVector3(TaylorModel v[3]);
00053   TVector3(const TaylorModel& v0, const TaylorModel& v1, const TaylorModel& v2);
00054   TVector3(const Vec3f& v, const boost::shared_ptr<TimeInterval>& time_interval);
00055 
00056   TVector3 operator + (const TVector3& other) const;
00057   TVector3& operator += (const TVector3& other);
00058 
00059   TVector3 operator + (FCL_REAL d) const;
00060   TVector3& operator += (FCL_REAL d);
00061 
00062   TVector3 operator - (const TVector3& other) const;
00063   TVector3& operator -= (const TVector3& other);
00064 
00065   TVector3 operator * (const TaylorModel& d) const;
00066   TVector3& operator *= (const TaylorModel& d);
00067   TVector3 operator * (FCL_REAL d) const;
00068   TVector3& operator *= (FCL_REAL d);
00069 
00070   const TaylorModel& operator [] (size_t i) const;
00071   TaylorModel& operator [] (size_t i);
00072 
00073   TaylorModel dot(const TVector3& other) const;
00074   TVector3 cross(const TVector3& other) const;
00075   TaylorModel dot(const Vec3f& other) const;
00076   TVector3 cross(const Vec3f& other) const;
00077 
00078   IVector3 getBound() const;
00079   IVector3 getBound(FCL_REAL t) const;
00080 
00081   void print() const;
00082   FCL_REAL volumn() const;
00083   void setZero();
00084 
00085   TaylorModel squareLength() const;
00086 
00087   void setTimeInterval(const boost::shared_ptr<TimeInterval>& time_interval);
00088 };
00089 
00090 void generateTVector3ForLinearFunc(TVector3& v, const Vec3f& position, const Vec3f& velocity);
00091 
00092 
00093 }
00094 
00095 #endif