Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
#define sin_d(x) (sin((x)*M_PI/180))
#define cos_d(x) (cos((x)*M_PI/180))
int pixx = 0;
int pixy = 0;
int radius = 100;
int centerx = 400;
int centery = 300;
for( double x = 0.0; x < (200*2.1415); x += 0.1 )
{
pixx = static_cast<int>(centerx+radius*cos_d(x));
pixy = static_cast<int>(centery+radius*sin_d(x));
PixelDraw( static_cast<int>(pixx) ,static_cast<int>(pixy), RGB(255,255,255) );
//PixelDraw( static_cast<int>(pixx+1) ,static_cast<int>(pixy), RGB(255,255,255) );
}
loglist RotateCameraSteerLeft_Orbit( float& cameraposx, float& cameraposz,
float& cameralookx, float& cameralookz,
float cameraradius )
{
//declaring vars which are used to calculate where the camerapos and cameralookpos should go
int circlequadrant;//1:topleft, 2:topright, 3:bottomleft, 4:bottomright
float centerx = cameralookx;//( cameraposx + cameralookx ) / 2;
float centerz = cameralookz;//( cameraposz + cameralookz ) / 2;
float radius = cameraradius;
loglist returnlist;
sprintf( returnlist.extras, "%s", "started rotcamstrlft_orbit function-");
//filling in the circlequadrant variable. this var is used to determine which ca***ation
//is being used to calculate where the camerapos and cameralookpos should move.
if( cameraposx < cameralookx )//the camera is in the left quadrant(looking along the z axis)
{
if( cameraposz > cameralookz )//the camera is in the top quadrant(looking along the y axis)
{
circlequadrant = 1;
}
else if( cameraposz < cameralookz )//the camera is in the bottom quadrant(looking along the y axis)
{
circlequadrant = 3;
}
else//the camera is in line with the look(looking along the z axis)
{
cameraposz-=rotatespeed;
//cameralookz-=rotatespeed;
loglist temp( circlequadrant, centerx, centerz, rotatespeed,
cameralookz, cameralookx, cameraposx, cameraposz );
returnlist = temp;
return returnlist;
}
}
else if( cameraposx > cameralookx )//te camera is in the right quadrant(looking along the z axis)
{
if( cameraposz > cameralookz )//the camera is in the top quadrant(looking along the y axis)
{
circlequadrant = 2;
}
else if( cameraposz < cameralookz )//the camera is in the bottom quadrant(looking along the y axis)
{
circlequadrant = 4;
}
else//the camera is in line with the look(looking along the z axis)
{
cameraposz+=rotatespeed;
//cameralookz+=rotatespeed;
loglist temp( circlequadrant, centerx, centerz, rotatespeed,
cameralookz, cameralookx, cameraposx, cameraposz );
returnlist = temp;
return returnlist;
}
}
else//the camera is in line with the look(looking along the z axis)
{
if( cameraposz < cameralookz )
{
cameraposx+=rotatespeed;
}
else if( cameraposz > cameralookz )
{
cameraposx -= rotatespeed;
}
else
{
//this should never be the case
}
//cameralookx+=rotatespeed;
loglist temp( circlequadrant, centerx, centerz, rotatespeed,
cameralookz, cameralookx, cameraposx, cameraposz );
returnlist = temp;
return returnlist;
}
for( int x = 0; x < 1000; x++ )
{
if( circlequadrant == 1 )//the camera is in the topleft quadrant(looking along the y axis)
{
if( sqrt((cameraposz-cameralookz)*(cameraposz-cameralookz)+(cameralookx-cameraposx)*(cameralookx-cameraposx)) <= radius )
cameraposz-=rotatespeed;
if( sqrt((cameraposz-cameralookz)*(cameraposz-cameralookz)+(cameralookx-cameraposx)*(cameralookx-cameraposx)) > radius )
cameraposx-=rotatespeed;
}
if( circlequadrant == 2 )//the camera is in the topright quadrant(looking along the y axis)
{
if( sqrt((cameraposz-cameralookz)*(cameraposz-cameralookz)+(cameraposx-cameralookx)*(cameraposx-cameralookx)) <= radius )
cameraposx-=rotatespeed;
if( sqrt((cameraposz-cameralookz)*(cameraposz-cameralookz)+(cameraposx-cameralookx)*(cameraposx-cameralookx)) > radius )
cameraposz+=rotatespeed;
}
if( circlequadrant == 3 )//the camera is in the bottomleft quadrant(looking along the y axis)
{
if( sqrt((cameralookz-cameraposz)*(cameralookz-cameraposz)+(cameralookx-cameraposx)*(cameralookx-cameraposx)) <= radius )
cameraposz-=rotatespeed;
if( sqrt((cameralookz-cameraposz)*(cameralookz-cameraposz)+(cameralookx-cameraposx)*(cameralookx-cameraposx)) > radius )
cameraposx+=rotatespeed;
}
if( circlequadrant == 4 )//the camera is in de bottomright quadrant(looking along the y axis)
{
if( sqrt((cameralookz-cameraposz)*(cameralookz-cameraposz)+(cameraposx-cameralookx)*(cameraposx-cameralookx)) <= radius )
cameraposz+=rotatespeed;
if( sqrt((cameralookz-cameraposz)*(cameralookz-cameraposz)+(cameraposx-cameralookx)*(cameraposx-cameralookx)) > radius )
cameraposx+=rotatespeed;
}
}
loglist temp( circlequadrant, centerx, centerz, rotatespeed,
cameralookz, cameralookx, cameraposx, cameraposz );
returnlist = temp;
return returnlist;
}
p.s. 2*3.14 is niet genoeg aangezien het antwoord hiervan 6 is en een cirkel 360 graden is.
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.