Witam,
kolejne zapewne iście banalne zagadnienie, na które mam problem znaleźć rozwiązanie.
Mam w c++ napisać kawałek kodu, dzięki któremu sfera będzie odbijać się od dwóch punktów. Mam takie funcje:
void RotateX( float ); // e.g. cube->RotateX( 0.05 );
void RotateY( float ); // e.g. sphere->RotateY( -0.1 );
void RotateZ( float ); // e.g. torus->RotateZ( 0.3 );
void MoveX( float ); // e.g. torus->MoveX( 0.1 );
void MoveY( float ); // e.g. cube->MoveY( -0.2 );
void MoveZ( float ); // e.g. cube->MoveZ( 0.4 );
// The Set functions allow you to set the X, Y or Z coordinates of a model to a
// given value
void SetX( float ); // e.g. cube1->SetX( -20 );
void SetY( float ); // e.g. cube2->SetY( 10 );
void SetZ( float ); // etc.
// Set all axes at once (as CreateModel) e.g. myModel->SetPosition( 20, 0, 10 );
void SetPosition ( float X, float Y, float Z );
// The Get functions return the current X, Y or Z position of a model
float GetX(); // e.g. xpos = sphere->GetX();
float GetY(); // e.g. if (sphere->GetY() > 10)
float GetZ(); // etc.
teraz jak to zrobić by owy obiekt odbijał się w kółko np od współrzędnych (40, 0, 0) (-40, 0, 0)?