microsoft / microsoft/msagljs

Fix for spline PathOptimizer::getSleeve

Open
#63 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
175
Forks
18
Avg merge
6d 3h
Merged PRs (30d)
4

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in PathOptimizer at getSleeve and trace the findSourceTriangle(localCdt) call that can provide an undefined sourceTriangle. Reproduce the failure with the graph JSON and usage code mentioned by the reporter, then verify that the spline path optimization handles the missing triangle without dereferencing an undefined value.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.