11.11.2009, 00:20
okay, I have been trying for the past couple of weeks to get a 3 dimensional trigonometry function working, basically it accepts and origin (x, y, z) a radius, tilt, facingangle, and an angle, and returns the new 3d point.
parameters explained:
EDIT:
Imagine a sphere the center of which is xyz if i wanted to get the points of a circle on the xy plane of that sphere i would do
and as angle grew i would get the points along the circumference of a circle whose radius is radius and whose origin is xy.
now all i want to be able to do is make the circle able to be tilted, bringing it into the 3rd dimension <currently getting a picture for this>
so tilt will make this circle tilt towards straight upwards as the tiltangle approaches 90.0.
facingangle governs which way the circle is tilted. So if you are south and you have objects all along the circumference of a 2d circle if facingangle was 0.0 and tilt became 10.0 you would see the objects pointing up right, but if facing angle was 180.0 you would see them face up left.
trying to get some pictures.
pawn Code:
Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
- x, y, z: the point from which the ending point will be incremented to (abstractly, the trig is performed at 0,0,0 then has these added to it)
- radius: the radius of the circle
- tilt: the degrees by which the circle is tilted (if it is 0.0 the circle is flat (z rotation) if it is 90.0 it faces straight up (isn't a certain kind of rotation unless facingangle is set to 0.0, 90.0, 180.0 270.0 ...)
- facingangle: which way the circle tilts
- angle: the basic 2d angle to be put onto the 3d circle.
- retx, rety, retz: the return parameters
EDIT:
Imagine a sphere the center of which is xyz if i wanted to get the points of a circle on the xy plane of that sphere i would do
pawn Code:
retx = (radius * floatcos(angle, degrees) + x);
rety = (radius * floatsin(angle, degrees) + y);
now all i want to be able to do is make the circle able to be tilted, bringing it into the 3rd dimension <currently getting a picture for this>
so tilt will make this circle tilt towards straight upwards as the tiltangle approaches 90.0.
facingangle governs which way the circle is tilted. So if you are south and you have objects all along the circumference of a 2d circle if facingangle was 0.0 and tilt became 10.0 you would see the objects pointing up right, but if facing angle was 180.0 you would see them face up left.
trying to get some pictures.