if (sqDist <= radius*radius) { originToIpnt.sub (iPnt, origin); dist[0] = originToIpnt.length(); freePoint3d(origin); freePoint3d(end); freePoint3d(iPnt); freeVector3d(originToIpnt); freeVector3d(direction); return true;
double sqDistToEdge; int j; for (int i=0; i<coordinates.length;i++) { j = (i < coordinates.length-1 ? i+1: 0); if (cyl instanceof PickCylinderSegment) { sqDistToEdge = Distance.segmentToSegment(origin, end, coordinates[i], coordinates[j], iPnt1, iPnt, null); } else { sqDistToEdge = Distance.rayToSegment(origin, direction, coordinates[i], coordinates[j], iPnt1, iPnt, null); } if (sqDistToEdge <= radius*radius) { originToIpnt.sub (iPnt1, origin); dist[0] = originToIpnt.length(); freePoint3d(origin); freePoint3d(end); freeVector3d(direction); freeVector3d(originToIpnt); freePoint3d(iPnt1); return true; }
    boolean intersectCylinder(Point3d pt, PickCylinder cyl,			      double[] dist) {		Point3d origin = getPoint3d();	Point3d end = getPoint3d();	Vector3d direction = getVector3d();	Point3d iPnt = getPoint3d();	Vector3d originToIpnt = getVector3d();	// Get cylinder information	cyl.getOrigin (origin);	cyl.getDirection (direction);	double radius = cyl.getRadius ();	double sqDist;	if (cyl instanceof PickCylinderSegment) {	    ((PickCylinderSegment)cyl).getEnd (end);	    sqDist = Distance.pointToSegment(pt, origin, end, iPnt, null);	}	else {	    sqDist = Distance.pointToRay(pt, origin, direction, iPnt, null);	}	if (sqDist <= radius*radius) {	    originToIpnt.sub (iPnt, origin);	    dist[0] = originToIpnt.length();	    freePoint3d(origin);	    freePoint3d(end);	    freePoint3d(iPnt);	    freeVector3d(originToIpnt);	    freeVector3d(direction);	    return true;	}	freePoint3d(origin);	freePoint3d(end);	freePoint3d(iPnt);	freeVector3d(originToIpnt);	freeVector3d(direction);	return false;    }