Grasshopper

algorithmic modeling for Rhino

Hello,

I've been having some trouble using the Rhino.Geometry.Intersect.Intersection.RayShoot function. It seems that sometimes it works, other times it doesn't return a proper Point3d [] array (or so it seems, I just get the "1. Solution exception:Object reference not set to an instance of an object." error).

Code is simply trying to find the first ray intersection on a set of surfaces:

Point3d Intersect(List<Surface> s, Ray3d ray)
{
    Point3d [] pts = Rhino.Geometry.Intersect.Intersection.RayShoot(ray, s, 1);
    f (pts.Length != 0 && pts[0].IsValid)
    {
        return pts[0];
    }
    return ray.Position;
}

Anyone have any idea of what I'm doing wrong? Can post more code if necessary...

Views: 395

Replies to This Discussion

Does s perhaps contain null elements?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service