Click to See Complete Forum and Search --> : Triangle wedge to Arch wedge


ShadowRunner666
February 15th, 2009, 10:15 AM
I need to change a triangle with a curved side into a arch shaped wedge.
The triangle is made up of 4 points along the outside edge connected to the middle point, so what I need to do is created 4 new points close to the ouside edge and have the colored faces connect with it.

Tbat::Tbat(void)
{
int i = 0;
double angle = 0.0, rad_angle = 0.0;
double z = 0.0;
double x = 0.0;
double y = -4.0;
for(i=0;i<=9;i++)
{
//int angle=10*i;

//Transform degrees into rads
rad_angle=(pi*angle)/180.0;
//Calculate the x and z co-ordinates or circle ground
x=radius/(sqrt(1.0+tan(rad_angle)*tan(rad_angle)));
z=radius*(sqrt(1.0-(1.0/(1.0+tan(rad_angle)*tan(rad_angle)))));
angle+=10;

//Quadrant co-ordinates of ground
if((i>=2)&&(i<9)) //First Quad
{
if(i==9)
{
_points[i]=TVector(0.0, 0.0, 1.0);
}
_points[i]=TVector(x,y,z);
}

_normal = TVector(0.0, 1.0, 0.0);
}
///// and the back
for(i=0;i<=9;i++)
{
//int angle=10*i;

//Transform degrees into rads
rad_angle=(pi*angle)/180.0;
//Calculate the x and z co-ordinates or circle ground
x=(radius-20)/(sqrt(1.0+tan(rad_angle)*tan(rad_angle)));
z=(radius-20)*(sqrt(1.0-(1.0/(1.0+tan(rad_angle)*tan(rad_angle)))));
angle+=10;

//Quadrant co-ordinates of ground
if((i>=2)&&(i<9)) //Front Quad
{
if(i==9)
{
_points1[i]=TVector(0.0, 0.0, 1.0);
}
_points1[i]=TVector(x,y,z);
}

_normal = TVector(0.0, 1.0, 0.0);
}

}

Tbat::~Tbat(void)
{
}


void Tbat::DrawBat()
{
int i=0.0;
glPushMatrix();
glPushAttrib(GL_ENABLE_BIT);
glCallList(50);
glEnable(GL_TEXTURE_2D);

glBegin(GL_POLYGON);
for(i=0; i<=9; i++)
{
glNormal3f(0.0, 0.0, 0.0);
glVertex3f(_points[i].X(), _points[i].Y(), _points[i].Z());
}
glEnd();



glBegin(GL_POLYGON);
for(i=0; i<=9; i++)
{
glNormal3f(0.0, 0.0, 0.0);
glVertex3f(_points[i].X(), _points[i].Y()+25, _points[i].Z());
}
glEnd();

for(i=0; i<=9; i++)
{
glBegin(GL_POLYGON);


// glNormal3f(0.0, 0.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(_points[i].X(), _points[i].Y(), _points[i].Z());
glVertex3f(_points[i].X(), _points[i].Y()+25, _points[i].Z());
glColor3f(1.0, 0.0, 1.0);
glVertex3f(_points[i+1].X(), _points[i+1].Y()+25, _points[i+1].Z());
glVertex3f(_points[i+1].X(), _points[i+1].Y(), _points[i+1].Z());

glEnd();
}
glDisable(GL_TEXTURE_2D);
glPopAttrib();
glPopMatrix();
}


This is the current code I have for making the triangle/bat. I just have no clue how to define the new points that I need to make to connect the faces to