msagljs icon indicating copy to clipboard operation
msagljs copied to clipboard

Fix for spline PathOptimizer::getSleeve

Open redexp opened this issue 1 year ago • 1 comments

Good day

I was playing around with this lib and stuck with error that on this line

if (t.containsPoint(this.poly.end)) {

t is undefined It's because method private getSleeve(sourceTriangle: Tr) gets sourceTriangle === undefined. Looking in code I found that this method used only ones

    const sleeve: FrontEdge[] = this.getSleeve(this.findSourceTriangle(localCdt))
    if (sleeve == null) {

so result of this method could be null or undefined and I decided to add check for sourceTriangle like

  private getSleeve(sourceTriangle: Tr): FrontEdge[] {
    if (!sourceTriangle) return;

and error gone

Why this.findSourceTriangle(localCdt) returns undefined I don't know, but I can give you my graph in json and code how I use it.

redexp avatar Jul 28 '23 15:07 redexp