Code: Alles auswählen
// X Rotation
result.x = point.x;
result.y = rotatePoint.y + (cos(rotateAngle.x) * d.y - sin(rotateAngle.x) * d.z);
result.z = rotatePoint.z + (sin(rotateAngle.x) * d.y + cos(rotateAngle.x) * d.z);
// Y Rotation
result.x = rotatePoint.x + (cos(rotateAngle.y) * d.x - sin(rotateAngle.y) * d.z);
result.y = point.y;
result.z = rotatePoint.z + (sin(rotateAngle.y) * d.x + cos(rotateAngle.y) * d.z);
// Z Rotation
result.x = rotatePoint.x + (cos(rotateAngle.z) * d.x - sin(rotateAngle.z) * d.y);
result.y = rotatePoint.y + (sin(rotateAngle.z) * d.x + cos(rotateAngle.z) * d.y);
result.z = point.z;
Nur hab ich das nicht ganz hinbekommen:
Code: Alles auswählen
// X + Y + Z Rotation
result.x = rotatePoint.x + (cos(rotateAngle.y) * cos(rotateAngle.z) * d.x - sin(rotateAngle.z) * d.y - sin(rotateAngle.y) * d.z);
result.y = rotatePoint.y + (sin(rotateAngle.z) * d.x + cos(rotateAngle.z) * cos(rotateAngle.x) * d.y - sin(rotateAngle.x) * d.z);
result.z = rotatePoint.z + (sin(rotateAngle.y) * d.x + cos(rotateAngle.y) * cos(rotateAngle.x) * d.z + sin(rotateAngle.x) * d.y);
Andreas