Arc breaks and splits into multiple line segments

The function of the company's plug-in for beam-aligned inclined plates has been updated. According to the designer's request, the arc beam can be split and aligned to the top of the plate.

This article only discusses the split arc beam, and the ellipse will be updated later.

  1. First look at the following arc creation api. Insert image description here
    The API provides three methods.
    The first is to specify the starting point and end point, and finally select the arc formed by the vertices.
    The second is to specify the face, radius, starting point angle and end point angle.
    The third way is Arc center point, radius, starting point angle, end point angle, x vector, y vector

  2. Splitting the arc means that if you encounter a board boundary and need to split it, you need to divide the arc into two arcs according to the board boundary. The first method is definitely not possible, and the latter two require understanding of what is the starting point. Angle and end point angle, and how to calculate

  3. The following is my understanding. I will continue to add more after it is completely completed. It may be a little confusing and I am afraid I will forget it later (all arcs rotate counterclockwise)

    • There are three parameters (xDir, yDir, normal) inside the arc. These three parameters represent the transverse vector, the longitudinal vector, and the normal vector.
    • The following is a comparison of two opposite values. It can be found that the normal vector determines the entire arc direction on both sides. Here you can use the right-hand rule to understand
      Insert image description here
      Insert image description here
  • In other words, if we follow the conventional arrangement here, we can find startangle and endangle, and the formula is as follows:
 var dir0 = (arc.GetEndPoint(0) - arc.Center).Normalize();
                    var dir1 = (arc.GetEndPoint(1) - arc.Center).Normalize();

Insert image description here

  • As can be seen from the above figure, the startAngle represented by α is greater than the endAngle of β. The entire angle is completely opposite, so when we split it, we can split it in the opposite direction to obtain the corresponding new arc.
		double endAngle = dir0.AngleOnPlaneTo(arc.XDirection, arc.Normal);
        double startAngle = dir1.AngleOnPlaneTo(arc.XDirection, arc.Normal);
        double intersectAngle = dir.AngleOnPlaneTo(arc.XDirection, arc.Normal);
  • As mentioned earlier, the right-hand rule is used to relate the normal vector to Y.
  • The combination of flashbacks can form a new arc arc and complete the split
var fakeNewLine = Arc.Create(arc.Center, arc.Radius, startAngle, intersectAngle, arc.XDirection,
                                -arc.YDirection);
newLine = fakeNewLine.CreateReversed();
var fakeLine = Arc.Create(arc.Center, arc.Radius, intersectAngle, endAngle, arc.XDirection,
                                -arc.YDirection);
 line = fakeLine.CreateReversed();
  • The beam-equal inclined plate has not been completed here. Because we are splitting it counterclockwise, we need to turn the entire arc upside down to complete the final style conversion. The following is the result picture
    Insert image description here
    Insert image description here

Guess you like

Origin blog.csdn.net/qq_41059339/article/details/130704974