Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / complect math problem

Author
Message
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 19th Jan 2004 04:29 Edited at: 19th Jan 2004 05:22
first off, yes i cant spell i meant either complicated or complex and ended up with a cross of the two

what i want is help making an equasion that can find the x,y,z position of a point that sits on a sphere, useing the diameter of the sphere and two angles the verticle elevation and the horizontal rotation eg. if u look at the world i would be talking about the latitude and longitude

any help would be apreciated

(p.s. my first attempt i had a cylinder and my last atempt i ended up finding the equasion for a torus, weird huh, if any wants it just ask)

to help ppl understand what im getting at ill throw in 2 examples that i would use this equasion for:

1)if i had 100 plain objects and positioned them acording to the equasion using random angles and a radius of 1, id then end up with a sphere made up of objects, by changing the radius i can then make a spherical exploding particle effect similar to the one in the db example which uses a cube like pattern

2) by using the mousemovex() and ~y() commands to inc/dec the angles then positon the camera useing the equasion and pointing it to an object at the center of the imaginary sphere i can look around it yet keep a uniform distance which i can change to make a zoom in effect
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Jan 2004 12:39
I know I've down something similar before, but I can't remember how, nor can I find my code anywhere. I did find this code from an abandoned project of mine. Maybe it can help you.

"eureka" - Archimedes
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 19th Jan 2004 15:28
i dont think i can use that ... little hard to follow ... but the example thing is cool what were u using it for?

just for reference i tryed using xpos = sin (a) sin (b)
ypos = sin (a) cos (b)
zpos = cos (a) or somthing very close but it just doesnt work with what i want
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Jan 2004 16:25
The plan was to eventually get the matrix to act like cloth over a ball.

Your equations are going to have the radius of the sphere multiplied in there somewhere.

"eureka" - Archimedes
GameKit
22
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 19th Jan 2004 16:52 Edited at: 19th Jan 2004 16:57
I don't know if this will work, but you can try it...

Make Object Sphere 999,0
Position Object 999,SphereXPos#,SphereYPos#,SphereZPos#
Rotate Object 999,AngX#,AngY#,0
Move Object 999,Radius#
NewX#=Object Position X(999)
NewY#=Object Position Y(999)
NewZ#=Object Position Z(999)
Delete Object 999

This will simply make an object and position it at the center of the "sphere", it then rotates it, moves it the givin radius, and gives you the 3-D coordinants... I made the object 999 so it doesn't ruin the rest of your code, but feel free to change it to any number you wish... the SphereXPos#, SphereYPos#, and SphereZPos# are the coordinants of the center of the sphere...

well... i hope that helps...

[edit...]
If Make Object Sphere 999,0 doesn't work, change the "0" to "1"

Do not thwart the way of the dragon. For thou tasteth like chicken.

Login to post a reply

Server time is: 2025-05-22 15:14:04
Your offset time is: 2025-05-22 15:14:04