I want an intersect, but not using geometry

I vaguely recall there’s a way to take a point, cast a ray (or something) and get the point where it would intersect with stuff…

I’ve done it as lines in this image:

Can anyone tell me how to do it without drawing lines?

Raybounce is in the Data-Shapes package.
Don’t know if it only bounces on solids

It is RayBounce as @Marcel_Rijsmus states. I believe the article below covers what you are trying to do.

You can also do it mathematically through vectors, but what’s the issue with using lines? Why do you need to avoid geometry?

That’s the method I went with (altho so far I’ve only got it working for 1 point).

I’ve not just got 1 line to pass, I’ve got loads…

I want the last point in the list of each “ray” A ray bounce won’t work as I want it to pass through solids and keep going with no deflection.

Geometry slows stuff down. I want fast.

Also fun do do different things different ways.

Geometry does slow stuff down but it has its benefits (like you mentioned above with multiple intersections). There are ways to make the geometry analysis more efficient or you can go with vector analysis like I mentioned. It’s a little more involved but it is a lighter computation.

1 Like
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import math

origin = IN[0]
outline = IN[1]  #curves to cross
vectors = IN[2]

StartPoints = []
EndPoints = []
for curve in outline: 
	Start = curve.StartPoint
	StartPoints.append(Start)
	End = curve.EndPoint
	EndPoints.append(End)

# Calculate t value
t = (origin.X - StartPoints[0].X) / (EndPoints[0].X - StartPoints[0].X)


# Calculate y and z coordinates of the intersection point
intersection_y = StartPoints[0].Y + t * (EndPoints[0].Y - StartPoints[0].Y)

intersection_point = Point.ByCoordinates(origin.X, intersection_y, 0)
OUT = intersection_point

So just have to stick everything in a loop…

But sadly I’ve been asked to do some boring work first. :frowning:

1 Like