Beispiel #1
0
static void
doTextHere(pixel **                   const pixels,
           unsigned int               const cols,
           unsigned int               const rows,
           pixval                     const maxval,
           const struct drawCommand * const commandP,
           struct drawState *         const drawStateP) {
    
    ppmd_text(pixels, cols, rows, maxval,
              drawStateP->currentPos.x,
              drawStateP->currentPos.y,
              commandP->u.textArg.height,
              commandP->u.textArg.angle,
              commandP->u.textArg.text,
              PPMD_NULLDRAWPROC,
              &drawStateP->color);
    
    {
        int left, top, right, bottom;
        
        ppmd_text_box(commandP->u.textArg.height, 0,
                      commandP->u.textArg.text,
                      &left, &top, &right, &bottom);
        

        drawStateP->currentPos.x +=
            ROUND((right-left) * cosdeg(commandP->u.textArg.angle));
        drawStateP->currentPos.y -=
            ROUND((right-left) * sindeg(commandP->u.textArg.angle));
    }
}
Beispiel #2
0
Quaternion* EulerToQuat(float pitch,float yaw,float roll){
	float cr=cosdeg(-roll/2.0);
	float cp=cosdeg(pitch/2.0);
	float cy=cosdeg(yaw/2.0);
	float sr=sindeg(-roll/2.0);
	float sp=sindeg(pitch/2.0);
	float sy=sindeg(yaw/2.0);
	float cpcy=cp*cy;
	float spsy=sp*sy;
	float spcy=sp*cy;
	float cpsy=cp*sy;
	Quaternion* q=new Quaternion;
	q->w=cr*cpcy+sr*spsy;
	q->x=sr*cpcy-cr*spsy;
	q->y=cr*spcy+sr*cpsy;
	q->z=cr*cpsy-sr*spcy;
	return q;
}
Beispiel #3
0
// bbdoc: Creates a quaternion from an angle and an axis
void Quaternion_FromAngleAxis( float angle, float ax, float ay, float az, float &rx, float &ry, float &rz, float &rw){
	
	float ha = .5*angle;
	float sn = sindeg( ha );
	
	rw = cosdeg( ha );
	rx = sn * ax;
	ry = sn * ay;
	rz = sn * az;
	
}