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