You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Add code as parameter
private static TextShape _ParseCode(ShxFile file, uint code, byte[] data, double scale)
{
var currentP = new Point();
var polyLines = new List<PolyLine>();
var currentPolyLine = new List<Point>();
var sp = new Stack<Point>();
var isPenDown = false;
for (int i = 0; i < data.Length; i++)
{
var cb = data[i];
if (i == 0 && cb == code) continue; // add this
switch (cb)
{
case 0x00:
break;
Solution for bulge (Problem was radian and center of bulge are not calculated properly) :
private static IEnumerable<Point> _GenerateArcPoints(Point start, Vector2 distance, double bulge)
{
var end = start + distance;
var isClockwise = bulge < 0;
var isLargeAngle = false;
bulge = Math.Abs(bulge);
var halfLength = Vector2.Distance(distance, Vector2.Zero) / 2;
var h = halfLength * bulge;
var radian = 4 * Math.Atan(bulge);// Add This for correct radian
var normal = new Vector2(distance.Y, -distance.X);
normal.Normalize();
var radius = Math.Abs(halfLength / Math.Sin(radian / 2));
var temp = Math.Sqrt((radius * radius) - (halfLength * halfLength)); // Add This for correct center
normal *= temp; // Add This for correct center
var center = start + distance / 2;
if (isLargeAngle ^ isClockwise)
center += normal;
else center -= normal;
The text was updated successfully, but these errors were encountered:
The solution to weird vertical alignment:
Solution for bulge (Problem was radian and center of bulge are not calculated properly) :
The text was updated successfully, but these errors were encountered: