You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
line2.closestPoint(..) should return a point on the line which is closest to the provided point.
Actual Behavior
In some cases line2.closestPoint(..) returns a point which is not on the line (see screenshots below).
If we consider a line going from [10, 0] to [0, 10] and try to get the point on the line which is closest to [0, 0] we get [-0.5952027266534774, 0.7912811580260264]. The correct result would be [5, 5].
If we switch to the line3.closestPoint(..) function and add 0 as the Z value for all the points we will get the correct result.
Steps to Reproduce the Problem
Get the closest point and draw a circle around it. The result is not correct
constjscad=require('@jscad/modeling')const{ line, circle }=jscad.primitivesconst{ line2 }=jscad.maths;constmain=()=>{conststart=[10,0];constend=[0,10];constpoint=[0,0];constl=line2.fromPoints(line2.create(),start,end);constclosest=line2.closestPoint(l,point);return[line([start,end]),circle({radius: 0.2,center: closest})];}module.exports={ main }
Get the closest point using line3. This one returns the correct result.
constjscad=require('@jscad/modeling')const{ line, circle }=jscad.primitivesconst{ line3 }=jscad.maths;constmain=()=>{conststart=[10,0,0];constend=[0,10,0];constpoint=[0,0,0];constl=line3.fromPoints(line3.create(),start,end);constclosest=line3.closestPoint(l,point);console.log(closest);return[line([start,end]),circle({radius: 0.2,center: closest})];}module.exports={ main }
Specifications
Version: modeling 2.11.0
Platform: all
Environment: all
The text was updated successfully, but these errors were encountered:
Expected Behavior
line2.closestPoint(..) should return a point on the line which is closest to the provided point.
Actual Behavior
In some cases line2.closestPoint(..) returns a point which is not on the line (see screenshots below).
If we consider a line going from [10, 0] to [0, 10] and try to get the point on the line which is closest to [0, 0] we get [-0.5952027266534774, 0.7912811580260264]. The correct result would be [5, 5].
If we switch to the line3.closestPoint(..) function and add 0 as the Z value for all the points we will get the correct result.
Steps to Reproduce the Problem
Get the closest point and draw a circle around it. The result is not correct
Get the closest point using line3. This one returns the correct result.
Specifications
The text was updated successfully, but these errors were encountered: