#### Archived

This topic is now archived and is closed to further replies.

# Distance Between Triangles

This topic is 6267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How would i find the distance between two triangles (in 3D) as a function of time? I know of algorithms that find triangle intersections and ones that find the distance between triangles, but not as a function of time. I can''t see how to somehow transfer distance algorithms into something like D(t)=equation*t.

##### Share on other sites
I dont'' understand what time has to do with the distance between 2 triangles. Unless the triangles are moving, in which case you would calculate the positions of the triangles at that time and then apply the normal formula to get the distance between them.

Trying is the first step towards failure.

##### Share on other sites
Re. the previous reply, time is only relevant where there is
some change to at least one of the triangles.
If the triangles are moving in some way, but their shape is
constant then in the general case they will be both spinning
and moving. This motion will probably be the result of a physics
integrator and it will be probably be nigh on impossible to
calculate the time of collision except by numeric approximation.
To do this you could binary chop a given time interval retrieving
what the positions and orientations would be at that time until
sufficient accuracy is achieved.
HOWEVER if the triangles are NOT controlled in this non-analytic
way the following possibilities are calculable:
(i) Constant rotation over time
(ii) Constant translation over time
If this is what you are after post a message on this thread with
more specific information and I''ll try to reply with some maths.

Regards

##### Share on other sites
sorry,
i meant for the distance between two triangles moving with a certain linear and angular velocity over a certain time period.

what i''m looking for is the exact time of intersection of two moving triangles.

Is there a nice(maybe long) equation where i could solve for T,
with the points of the triangles moving by it''s velocity multiplied by T?

The only way i know is to do a none time distance calculation and repeat it over some amount of timesteps until you reach the time period to pass.

the problem with this is that it need many distance calls for large time periods and can still not be correct for very large velocities.

##### Share on other sites
the "binary chop" method won''t help the problem of VERY fast changes in position and orientation over time.

about any math involved in this, I would like to know.

What i really want is some kind of math equation that
given the parameters points
a1,b1,c1 (triangle 1), a2,b2,c2 (triangle 2),
what is the distance between them.

from this equation i would make all the positions be something like: a1=a1+velocity*time+angular_velocity*time;

than solve for time and when the distance is 0.

##### Share on other sites
In my opinion the answer depends on how you represent your orientation (angular velocity). If the triangles hadn't been rotating there wouldn't be any problem, but when you throw in rotation, problems emerge. For example, does you angular velocity depend on how the triangle is rotated? I mean, do you define the angvel in the triangle's(object's) coordsystem or in worldcoordsystem? If it is defined in objectsystem you'll get: angvel(t) is a function of angvel(t-1).

Anyway how do you represent angular velocity...?

regards

/Mankind gave birth to God.

Edited by - silvren on September 24, 2001 1:24:19 PM

##### Share on other sites
The way i do it is to have a vector represent the axis that a triangle rotates by while the length of the vector is the amount of angualar velocity.

right now,
I think of representing triangles by an orientation (3x3 matrix)
and the angualar velocity changes it accordingly.

anyways,
i don''t think it''s so important to even name any type of velocity.

what i wish to find is just a math equation (not some big algorithm) that
"given the parameters points
a1,b1,c1 (triangle 1), a2,b2,c2 (triangle 2)"
equals the distance between them.

Is it possible to calculate such an equation without using an algorithm answer(if,loop..)

1. 1
Rutin
70
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633421
• Total Posts
3011798
• ### Who's Online (See full list)

There are no registered users currently online

×