void Object3d::scaleRelativeToPoint(Point3d p, float sx, float sy, float sz){
	//scale each pt
	for(unsigned int i=0;i<points.size();i++){
		points[i].scaleRelativeToPoint(p,sx,sy,sz);
	}
	computeAxis();
}
void Object3d::scale(float sx, float sy, float sz){
	//scale each pt
	for(unsigned int i=0;i<points.size();i++){
		points[i].scale(sx,sy,sz);
	}
	computeAxis();
}
Пример #3
0
//-------------------------------------------------------------------------------------
//	Object3D
//-------------------------------------------------------------------------------------
//constructor & destructor
Object3d::Object3d(std::vector<Point3d> points, std::vector<int> topology){
	this->points = points;
	this->topology = topology;
	//color
	colorx=colory=colorz=1;
	draw_axis=false;
	//compute axis
	axiscenter.set(0,0,0);
	axisup.set(0,2,0);
	axisright.set(2,0,0);
	axisfwd.set(0,0,2);
	computeAxis();
}
Пример #4
0
//-----------------------------------------------------------------------------------------------------
//	Object2d
//-----------------------------------------------------------------------------------------------------
//constructor & destructor
Object2d::Object2d(std::vector<Point2d> points, std::vector<int> topology){
	this->points = points;
	this->topology = topology;
	//color
	colorx=colory=colorz=1;
	//drawaxis
	drawaxis=true;
	//set axis
	axiscenter.set(0,0);
	axisup.set(0,1);
	axisright.set(1,0);
	computeAxis();
}
// Helper for constructor
void Rectangle2d::init()
{
	// Corners from upper right to lower right counterclockwise
	points.push_back(Point2d(length / 2, height / 2));
	points.push_back(Point2d(-length / 2, height / 2));
	points.push_back(Point2d(-length / 2, -height / 2));
	points.push_back(Point2d(length / 2, -height / 2));

	topology.push_back(0);
	topology.push_back(1);
	topology.push_back(2);
	topology.push_back(2);
	topology.push_back(3);
	topology.push_back(0);

	computeAxis();
}
// Helper method for circle creation
void Circle2d::init()
{
    this->points.push_back(Point2d(0, 0));

    for (float i = 0; abs(i - TWICE_PI) > DELTA; i += TWICE_PI / NUM_TRIANGLES)
        this->points.push_back(Point2d( radius * cos(i), radius * sin(i)));

    for (int i = 1; i <= NUM_TRIANGLES; ++i)
    {
        this->topology.push_back(0);
        this->topology.push_back(i);
        if (i != NUM_TRIANGLES)
            this->topology.push_back(i + 1);
        else
            this->topology.push_back(1);
    }
    computeAxis();
}