0

For a curve, I wanna move the start and end point to new position, and then how to keep the shape of the curve ?

image with points

From the points which circulated on the yellow curve, move them to red curve position which circulated on the red curve, how to keep the shape of the curve on the red curve ?

Jim Green
  • 1,088
  • 3
  • 15
  • 40
  • Are the curves always horizontally aligned? – T A May 28 '20 at 07:08
  • It seems that the red curves can be obtained by either offsetting or scale transforming the yellow curves. – fang May 28 '20 at 07:10
  • @fang you are right.Do you have some suggests? – Jim Green May 28 '20 at 08:11
  • @T A , it is uncertain. The offset of the start and end point is uncertain. – Jim Green May 28 '20 at 08:32
  • @fang I think you could help me. Move a nurbs curve the start and end point to another position, how to keep the shape of the new curve(which similar to the origin curve) ? – Jim Green May 28 '20 at 09:20
  • @OP: If you move the end point towards the start point so that their distance becomes half of the original distance, do you expect the chord height of the curve to also halved or remain unchanged? Also, is your curve in general 3d or always 2d? – fang May 28 '20 at 17:33
  • Possible duplicate of: [How to move nurbs curve when transplant the start and end point?](https://stackoverflow.com/questions/60888233/how-to-move-nurbs-curve-when-transplant-the-start-and-end-point) – Lee Mac May 28 '20 at 18:37
  • @fang 2d. Actually I am very curious about the curve variance on the CAD software. I only specify the start point and end point of a curve, when I scaled the curve to maximum size, It could keep the shape. How to realize it? You work in CAD for long time. – Jim Green May 29 '20 at 03:25
  • @fang I think you could help me. Another question reference by https://stackoverflow.com/questions/58767514/what-is-the-relationship-between-polylines-vertex-and-points-in-the-block-of-dxf/58817819?noredirect=1#comment104167331_58817819 and https://stackoverflow.com/questions/58765788/how-to-apply-grade-rule-table-to-dxf – Jim Green May 29 '20 at 03:29
  • @fang I wanna know how CAD only specify the offset of start and end point on the curve , when it scale to smaller or bigger size, It could keep the shape of the curve . What is the algorithm ? X1-(X1-X2)*( lx / L) reference by https://stackoverflow.com/questions/58767514/what-is-the-relationship-between-polylines-vertex-and-points-in-the-block-of-dxf/58817819?noredirect=1#comment104167331_58817819 is not so accurate . – Jim Green May 29 '20 at 03:34

2 Answers2

0

When you define spline curve you need to define also tangents angles at endpoints, when you move you points to center, you are chenging the slopes of side lines, so if tangent angles are fixed wrt lines, they will make curve change. If you will see carefully corner angles are same on both images. To keep your curves shape you need to change these angles according side lines slope chenges.

Andrey Smorodov
  • 10,649
  • 2
  • 35
  • 42
  • Thanks for your answer. Actually this is from base size DXF and grading rule table file from CAD software, I wanna grading this base size DXF to full size DXF based on the grading rule table.Do you have this experience? – Jim Green Jun 01 '20 at 03:30
0

So, let me summarize what you want to do here: given a Bezier curve or a B-spline curve and two new locations for the start point and end point, find a new Bezier/B-spline curve that more or less keeps the same shape as original curve.

One way to achieve this is to find a transformation that would transform the start/end points to their new locations, then you can apply the same transformation to all the other control points for the curve. Basically, this is the same as finding the transformation between a line defined by the curve's start point P and end point Q and another line defined by the new point locations P* and Q*. From P and P*, we can find a translation vector. From line PQ and line PQ, we can find a rotation angle. From length |PO| and length |PQ| we can find a scale factor. So, combining the translation vector, rotation angle and the scale factor, we will be able to find the transformation matrix. Apply the transformation matrix onto all the other control points, then you should be able to get the new curve that more or less maintain the same shape as original curve.

If what you really wan to do is to offset the curves, then this is a totally different story. Offset curves are achieved by a far-more complex algorithm (which I will not elaborate here) and we will specify offset distance (could be positive or negative to imply outwards/inwards offset) instead of new locations for the start/end points.

fang
  • 3,473
  • 1
  • 13
  • 19
  • Thanks for your correct summary. Actually this is from base size DXF and grading rule table file from CAD software, I wanna grading this base size DXF to full size DXF based on the grading rule table. – Jim Green Jun 01 '20 at 03:31
  • > 1.there is no control points, it is all the interpolation curve points. The control points could infered by the interpolation curve points. So I think translation vector, rotation angle and the scale factor would apply to the interpolation curve points if the method is possible > 2.You said from P and P*, we can find a translation vector, But what if from Q and Q* is different from P and P* ? > 3.X1-(X1-X2)*( lx / L) reference by stackoverflow.com/questions/58767514/… makes a little bit, but it is not so accurate – Jim Green Jun 01 '20 at 03:31
  • @OP: If the vec(Q,Q*) and vec(P,P*) are different, you will get a different translation and then a different rotation angle. This does not really matter. Eventually, you just want to find a way to deform the curve when its start/end points change and nobody say the solution needs to be unique. – fang Jun 01 '20 at 16:42
  • Could you tell something about the curve points change in the CAD software ? How does it change ? – Jim Green Jun 02 '20 at 02:20
  • I can only view the AAA-base.dxf but not the .rul file. I am not familar with .rul file and have no idea how to view it or utilize it with .dxf file.Sorry. – fang Jun 02 '20 at 03:25
  • ,rul file indicates different size has different offset of X/Y , Obviously the base size have 0 offset of X/Y. It apply to the based-dxf file on some key point. – Jim Green Jun 02 '20 at 06:21