Surface normal not perpendicular to Surface
The surface is an extrusion of a circle along the x axis. The x dimemsion at the end of the vector
should be the same as the begining of the vector. Front and perpective views are included.
The lines are added to show the vectors.
Below is the c# code used to create the normal vectors.
The steps in the code are a little overkill. This is what I ended up with after trying other ways
to make sure the point for the normal was on the surface
public void BranchProfileToRingCore2(RhinoDoc doc, RingProfile profile, Surface core_surface)
{
double u;
double v;
Guid point;
Guid line_id;
Point3d test_point;
Point3d[] points;
Vector3d base_vector;
Curve[] new_curve;
Brep pull_brep;
Curve curve = BullFallsPlugIn.Instance.settings_drawings.CurveFromGuid(profile.Bottom);
Curve test_curve = curve.DuplicateCurve();
test_point = profile.center_bottom;
pull_brep = core_surface.ToBrep();
Rhino.Geometry.Collections.BrepFaceList bref_faces = pull_brep.Faces;
new_curve = test_curve.PullToBrepFace(bref_faces[0], .000001);
doc.Objects.Delete(profile.Bottom, true);
Rhino.Geometry.NurbsCurve nncurve = new_curve[0].Rebuild(3, 3, true);
Guid new_curve_id = doc.Objects.AddCurve(nncurve);
Curve pulled_curve = BullFallsPlugIn.Instance.settings_drawings.CurveFromGuid(new_curve_id);
pulled_curve.DivideByCount( 2, true, out points);
temp_line.Add(new_curve_id);
bref_faces[0].ClosestPoint(points[1], out u, out v);
base_vector = bref_faces[0].NormalAt(u, v);
if (bref_faces[0].OrientationIsReversed)
base_vector.Reverse();
point = doc.Objects.AddPoint((Point3d)base_vector);
temp_point.Add(point);
Line line = new Line((Point3d)base_vector, profile.center_bottom);
line_id = doc.Objects.AddLine(line);
temp_line.Add(line_id);
}