Ejemplo n.º 1
0
void WallsUnits::applyHeightCorrections(ULength& dist, UAngle& fsInc, UAngle& bsInc, ULength ih, ULength th) const
{
    if (inch.isNonzero() || ih.isNonzero() || th.isNonzero())
    {
        UAngle inc = avgInc(fsInc + incv, bsInc + incvb);
        if (inc.isValid() && !isVertical(inc))
        {
            // horizontal offset before height correction
            ULength ne = ucos(inc) * (dist + incd);
            // vertical offset before height correction
            ULength u = usin(inc) * (dist + incd);

            u += inch;
            if (ih.isValid()) u += ih;
            if (th.isValid()) u -= th;

            // adjust fsInc/bsInc so that their new avg
            // is the corrected inclination
            UAngle dinc = uatan2(u, ne) - inc;
            fsInc += dinc;
            bsInc += (typevb_corrected ? dinc : -dinc);

            dist = usqrt(usq(ne) + usq(u)) - incd;
        }
    }
}
Ejemplo n.º 2
0
void drawCircle(const glPoint* point,GLfloat radius,const GLfloat* color,float width,int isFilled){
	/*座標設定*/
	glPushMatrix();
	glTranslatef(point->x,point->y,0.0);
	/*太さ設定*/
	glLineWidth(width);
	/*ブレンド設定*/
	int is_blend = (color[3] != 1.0);
	if(is_blend){
		glEnable( GL_BLEND );
		glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
	}else{
		glDisable( GL_BLEND );
	}
	/*カラー設定*/
	glColor4fv(color);
	/*頂点設定*/
	GLfloat vertex[724];
	int idx;
	if(isFilled){
		vertex[0] = vertex[1] = 0.0f;
		vertex[722] = radius;
		vertex[723] = 0.0f;
		idx = 1;
	}else{
		idx = 0;
	}
	int i=0;
	int arr_idx = 0;
	for(;i<360;i++){
		arr_idx = (idx+i)<<1;
		vertex[arr_idx] = (radius*ucos(i)) / BIT_POINT;
		vertex[arr_idx+1] = (radius*usin(i)) / BIT_POINT;
	}
	glEnableClientState( GL_VERTEX_ARRAY );
	glVertexPointer( 2, GL_FLOAT, 0, vertex );

	if(isFilled){
		glDrawArrays( GL_TRIANGLE_FAN, 0, 362 );
	}else{
		glDrawArrays( GL_LINE_LOOP, 0, 360 );
	}
	if(is_blend){
		glDisable( GL_BLEND );
	}
	glPopMatrix();
}
Ejemplo n.º 3
0
int16 __ext_cos_int16 ( int16 y ) {
	return (int16)ucos(y);
}