I have here a very curious problem. This is more about geometry aspects related to vectors.
So this is an exercise from the Dynamo Language Manual. The aim here is to create two continuous NURBSCurves in such a way that they maintain the tangency at their endpoints. For this the script creates the first set of control points, defines the NURBSCurve.
For the Second Curve, the first point is the same as the last one from previous set of points.
But to derive the second point, they do vector subtraction which I am not able to visualize and essentially be satisfied logically & geometrically.
Here’s the script:
pts_1={};
pts_1[0] = Autodesk.Point.ByCoordinates(0,0,0);
pts_1[1] = Autodesk.Point.ByCoordinates(1,1,0);
pts_1[2] = Autodesk.Point.ByCoordinates(5,0.2,0);
pts_1[3] = Autodesk.Point.ByCoordinates(9,-3,0);
pts_1[4] = Autodesk.Point.ByCoordinates(11,2,0);
crv_1 = NurbsCurve.ByControlPoints(pts_1, 3);
pts_2 = {};
pts_2[0] = pts_1[4];
end_dir = Autodesk.Point.Subtract(pts_1[4],(pts_1[3].AsVector()));
pts_2[1] = Autodesk.Point.ByCoordinates(pts_2[0].X + end_dir.X,
pts_2[0].Y + end_dir.Y, pts_2[0].Z + end_dir.Z);
pts_2[2] = Autodesk.Point.ByCoordinates(15,1,0);
pts_2[3] = Autodesk.Point.ByCoordinates(18,-2,0);
pts_2[4] = Autodesk.Point.ByCoordinates(21,0.5,0);
What it achieves is as below:
Now, I am getting stuck at understanding 2 things. Let me describe each one:
1. 1st query:
end_dir = Autodesk.Point.Subtract(pts_1[4],(pts_1[3].AsVector()));
This step subtracts point pts_1[3] from point pts_1[4] as vector. As far as I searched and understood, a (Point2 - Point1) gives a vector from Point2 to Point1.
See snip as I have understood it:
Question is am I correct in deciphering that here?
2. 2nd Query: The next step has bowled me out completely:
pts_2[1] = Autodesk.Point.ByCoordinates(pts_2[0].X + end_dir.X,
pts_2[0].Y + end_dir.Y, pts_2[0].Z + end_dir.Z);
I understand that it is adding vectors but when I try to put that graphically, it isn’t making sense to me. Essentially, I am not able to arrive graphically at the resultant pts_2[1] position.
I broke up the end_dir vector into its component axes and then also the axes of pts_2[0] point. And then tried to imagine how their addition would turn out. Here’s the snip of that break up: