Skip to main content
GameDev.net gamedev.net
🔒 Locked

3D Math

Started by os Apr 15, 2001 at 6:45 PM 9 replies 800+ views
Original Post
os
os
Does anyone knows how to compute (fast) a distance from a point to the TRIANGLE or where can I find any information about this question??? Thanks in advance. < http://oscp.pochta.org >
ECKILLER
ECKILLER
I''m not sure i get your question. You want the distance from a point to an arbitrary triangle? If so, you the distance equation:

d = sqrt( x^2 + y^2 + z^2 )

ECKILLER
ECKILLER
os
os
????????????
I think the formula d = sqrt( x^2 + y^2 + z^2 ) computes a distance from origin to some point
????????????

Are there any other offers???
os
os
YEAK, YEAK, YEAK....
I think that I''ll have distance from point to the triangle''s PLANE. If the projection to the triangle is not on the triangle??? What then ???

< oscp.pochta.org >
os
os
Thanks anyway...
sjelkjd
sjelkjd
quote:
Original post by os

Thanks anyway...


Depends on what you mean by distance. Distance requires two discrete points. You could pick any of the triangle''s points, or their arithmetic mean.

os
os
I think distance is a shortest route. And if I want to know distance from a point to the triangle it means that I want to know the shortest route from the point to some point of the triangle.

I am working on "movement in scene" now. I have some meshes in the scene (Floor, Walls and …) {you can see it at http://oscp.pochta.org). And I have a man walking this scene. And I don''t want this man can go through walls or fall through the floor…. As I see it the best way to do it is to compute distances from the center of this "man" to all triangles that are near the man. ("man" in this case will be something like sphere

So can anybody help me??? Or may be another way to solve this problem???
CpMan
CpMan
The shortest distance between two points is sqrt( (p2.x - p1.x)^2 + (p2.y - p1.y)^2 + (p2.z - p1.z)^2)
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.
os
os
You are merry chap, CpMan



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.