openep / openep-core

Core OpenEP code - Matlab implementation
Apache License 2.0
9 stars 6 forks source link

`freeBoundaries` does not calculate the full perimeter #45

Open p-j-smith opened 2 years ago

p-j-smith commented 2 years ago

In calculating the length of the free boundaries, freeBoundaries does not close the loop before calculating the length of the perimeter, i.e. the final point in the boundary does not return to the original point.

This can be seen with the following example of an equilateral triangle:

P = [
    [0, 0, 0],
    [1, 0, 0],
    [0, 1, 0],
]

T = [
    [1, 2, 3],
]

TR = TriRep(T, P)
[FF, l] = freeBoundaries(TR)

which returns the result of l = 2.142, whereas the correct result is 1 + sqrt(2) + 1 = 3.142