Answer the question
In order to leave comments, you need to log in
Quick search for triangle intersections (for 2D and 3D)?
What data structure is suitable for this? For a small number of triangles, one can directly compare each with each, but if their number increases significantly (for example, to 1,000 and 100), then 100,000 checks will have to be done.
Answer the question
In order to leave comments, you need to log in
Specifies a large two-dimensional array with a certain step.
All objects on the map are placed in this array.
The coordinates of objects allow you to calculate the indices of the array cells in which they should be located.
When it is necessary to check a certain object for intersection with another, we take only its cell neighbors.
From the book "Surrealism in JavaScript"
Inscribe each triangle in a rectangle and check for intersection only those triangles that intersect the rectangles describing them. And you can cut off a bunch of extra rectangles at once through quad-tree
Try to go in the direction of setting the vertices of the triangles as coordinates in space.
Then for each triangle it is possible to compose three parametric equations of lines, then compose such a system for each triangle. In theory, if you solve this general system of linear equations, you can somehow understand whether there are intersections.
Try to move in this direction: www.cleverstudents.ru/line_and_plane/parametric_eq... You
can solve it using the Jordan-Gauss method, or I don’t remember how it is. In general, I have already forgotten analytical geometry, but I advise you to delve into it, I'm sure there is a solution to this problem.
If I'm right, then the problem comes down to calculating a huge matrix.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question