PieceDistortion.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 #include "PieceDistortion.h"
00012 #include "path/Path.h"
00013 
00014 namespace Track
00015 {
00016 
00017 PieceDistortion::PieceDistortion(const PathEdge & edge,
00018                                  unsigned int number,
00019                                  btScalar length,
00020                                  btScalar min_y)
00021     :   edge(edge)
00022     ,   number(number)
00023     ,   length(length)
00024     ,   min_y(min_y)
00025 {
00026     
00027 }
00028 
00029 PieceDistortion::~PieceDistortion()
00030 {
00031 }
00032 
00033 btVector3 PieceDistortion::operator()(btVector3 vertex)
00034 {
00035     btScalar position = ((vertex.y() - min_y) / length + number) / edge.get_number_of_repetions();
00036     vertex.setY(0);
00037     return edge.get_transform(position)(vertex);
00038 }
00039 
00040 }

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

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