Intersections with rhino3dm.js


I was looking at the documentation of intersection class of rhino3dm.js and I was wondering if the lineline() static function is implemented and how it works. Is it like the RhinoCommon version that takes two lines and two doubles (or floats in the case of JS)? What type of object does it return? A boolean?


Seems the documentation leaves a lot to be desired for these methods. Check out the source here. It’s cpp but fairly straightforward to follow. LineLine in its most basic form takes two lines and returns three values: a bool indicating the success of the intersection and two doubles indicating the param on line a and line b.

Thanks! I’m interested in the LineLine2. The return object is an array? The C++ code shows a tuple but I was under the impression that these aren’t yet supported on JS.

const lineA = new rhino.Line([0,0,0], [10,10,0]);
const lineB = new rhino.Line([0,10,0], [10,0,0]);

let x = rhino.Intersection.lineLine(lineA, lineB, 0.1, true);

// prints:
// 0: true
// 1: 0.5
// 2: 0.5


1 Like

Sorry for bumping this old thread but rhino.Intersection.lineLine( lineA, lineB, tolerance, finiteSegments) has stopped working as it used to. Was this method deprecated in rhino8 version? I’m getting the following error:

Object { name: “BindingError”, message: “function Intersection.lineLine called with 4 arguments, expected 2 args!”, stack: “BindingError: function Intersection.lineLine called with 4 arguments, expected 2 args!\nrhino3dm</$e/t<@\nBindingError@ line 1 > Function:4:34\nBe@\nIntersection$lineLine@ line 1 > Function:5:18\nselfIntersecting@file:///Users/filipeb/10_DEV/Atom/roomsurveyorJS/RS_DrawMeasureSides/app.js:153:38\nprocessForm@file:///Users/filipeb/10_DEV/Atom/roomsurveyorJS/RS_DrawMeasureSides/app.js:48:8\n@debugger eval code:1:1\nBe@\nIntersection$lineLine@ line 1 > Function:5:18\nselfIntersecting@file:///Users/filipeb/10_DEV/Atom/roomsurveyorJS/RS_DrawMeasureSides/app.js:153:38\nprocessForm@file:///Users/filipeb/10_DEV/Atom/roomsurveyorJS/RS_DrawMeasureSides/app.js:48:8\nonclick@file:///Users/filipeb/10_DEV/Atom/roomsurveyorJS/RS_DrawMeasureSides/index.html:1:1\n” }

for reference I’m loading the latest version of rhino3dm. Should I use the version 7?

<script src=""></script> <!-- latest -->

Just answered myself. I can confirm the method is working in version 7.15.

there are two different intersection methods for LineLine in rhino3dm.js 8.0.1:

rhino.Intersection.lineLine( lineA, lineB )


rhino.Instersection.lineLineTolerance( lineA, lineB, tolerance, finiteSegments )

This is part of a change I made about 5 months ago and didn’t do a good job of documenting it.

Thanks @fraguada. That clears it up, the method was renamed.