Guest Red Ocktober Posted June 14, 2011 Share Posted June 14, 2011 how do i do this in BlitzMAX? --Mike Quote Link to comment Share on other sites More sharing options...
Aily Posted June 15, 2011 Share Posted June 15, 2011 distance betwen points local v1:tvec3=vec3(1,2,3) local v2:tvec3=vec3(4,5,6) distance#=sqr( (v1.x-v2.x)^2 + (v1.y-v2.y)^2 + (v1.z-v2.z)^2 ) Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Flexman Posted June 15, 2011 Share Posted June 15, 2011 Aily gives you the math which is better. If you're feeling lazy.... dist:float = Vec3(x1,y1,z1).DistanceTo(x2,y2,z2); Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted June 15, 2011 Share Posted June 15, 2011 THANKS... guys for both... --Mike Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted June 15, 2011 Share Posted June 15, 2011 ..this one should be faster, in case many time in your loops is used.. local v1:tvec3=vec3(1,2,3) local v2:tvec3=vec3(4,5,6) distance!=sqr( ((v1.x-v2.x) * (v1.x-v2.x)) + ((v1.y-v2.y) * (v1.y-v2.y)) + ((v1.z-v2.z) * (v1.z-v2.z)) ) Quote Link to comment Share on other sites More sharing options...
Aily Posted June 15, 2011 Share Posted June 15, 2011 One my friend say me to compare squares, not distances, because SQR is heavy command. So dist1#=(v1.x-v2.x) * (v1.x-v2.x) + (v1.y-v2.y) * (v1.y-v2.y) + (v1.z-v2.z) * (v1.z-v2.z) dist2#=(v1.x-v3.x) * (v1.x-v3.x) + (v1.y-v3.y) * (v1.y-v3.y) + (v1.z-v3.z) * (v1.z-v3.z) if dist1<dist2 .... Without SQR calcilations P.S. Cool glasses Alien Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.