void MoveToAction::update(float t) { Action::update(t); Point newPosition = PointAdd(this->origin, PointMake(this->delta.x * t, this->delta.y * t, this->delta.z * t)); this->get_target()->set_position(newPosition); }
void BluePrintDetect::ComputeCenterOfMass( vector<CloudModel*> clouds , Point& weightedPosR ){ float totalMass = 0; //its not really "mass" per se, but it represents the weighting factor used in computing the weighted center (aka, the center-of-mass) PointInit(0,0,0,weightedPosR); for(unsigned int i = 0; i < clouds.size();i++){ if(clouds[i]->getRadius() > 0){ CloudModel* cloud = clouds[i]; PointAdd( cloud->posX * cloud->getRadius(), cloud->posY * cloud->getRadius(), cloud->posZ * cloud->getRadius(), weightedPosR ); assert(cloud->getRadius()!=0); totalMass += cloud->getRadius(); } } PointDivide(totalMass,weightedPosR); }