Changes between Version 3 and Version 4 of NewDistCalcGeom2Geom


Ignore:
Timestamp:
Nov 8, 2009, 12:34:12 PM (14 years ago)
Author:
nicklas
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • NewDistCalcGeom2Geom

    v3 v4  
    3434
    3535This calculation is implanted instead of the array_array function when there is no intersection.
    36 I don’t know if the letters used is international but to describe a function of a line I here use y=k*x + z
     36I don’t know if the letters used is international but to describe a function of a line I here use y=k*x + z[[BR]]
     37
    3738The steps are:
    3839
    39 1. Find bounding box for the two point arrays
    40 2. Check if bounding boxes intersecting. If so, send to old function
    41 3. Find center of bounding boxes and calculate deltax and deltay from the two points
    42 4. Calculate the “z” value from y=kx+z for each vertex with k-value from the slope between the two bbox-center points. To eliminate problems with dividing with zero and other limitations when getting closer to dividing with zero we instead change the x-axes with the y-axes by “mirroring”  the coordinate system. In that way the “z”-value represents a lines crosspoint to the x-axes instead of the usual y-axes crossing. Hope it is understandable since I don’t know the terminology, but it works :-)
    43 5. Now we have a list with all vertexes with this calculated “z”-values together with the ordering-value from the geometry-array.
    44 6. We order this list by the calculated “z”-value
    45 7. Now we take the two points from our list that is most close to each other according to this “z”-value and calculate the distance between them. We translate the distance value so it will be comparable with our “z”-values
    46 8. Now, we start the iteration through the vertexes. We iterate in the z-value order, which means we compare points close to the other geometry according to our z-values before we compare the values more far away. We also stop the iteration at ones the next vertex is more far away from the other geometry than our smallest found distance so far. This will narrow the search for each new mindistance we find.
     40
     41 1. Find bounding box for the two point arrays
     42 2. Check if bounding boxes intersecting. If so, send to old function
     43 3. Find center of bounding boxes and calculate deltax and deltay from the two points
     44 4. Calculate the “z” value from y=kx+z for each vertex with k-value from the slope between the two bbox-center points. To eliminate problems with dividing with zero and other limitations when getting closer to dividing with zero we instead change the x-axes with the y-axes by “mirroring”  the coordinate system. In that way the “z”-value represents a lines crosspoint to the x-axes instead of the usual y-axes crossing. Hope it is understandable since I don’t know the terminology, but it works :-)
     45 5. Now we have a list with all vertexes with this calculated “z”-values together with the ordering-value from the geometry-array.
     46 6. We order this list by the calculated “z”-value
     47 7. Now we take the two points from our list that is most close to each other according to this “z”-value and calculate the distance between them. We translate the distance value so it will be comparable with our “z”-values
     48 8. Now, we start the iteration through the vertexes. We iterate in the z-value order, which means we compare points close to the other geometry according to our z-values before we compare the values more far away. We also stop the iteration at ones the next vertex is more far away from the other geometry than our smallest found distance so far. This will narrow the search for each new mindistance we find.
    4749
    4850