cart: empty [ Login ]

DxfArc Calculate Start and Endpoint (CadLib 4.0)

1 
DanielM
3/5/2024 4:39 PM
Hi, I am not really fit with mathematics :( Is there a helper Method to get start and endpoint from a DxfArc? Thanks Daniel
Wout
3/5/2024 4:49 PM
Hi, Should be something like this:
C# Code:
Matrix4D transform = arc.Transform * Transformation4D.Translation((Vector3D)arc.Center) * Transformation4D.Scaling(arc.Radius); Point3D center = transform.Transform(Point3D.Zero); Point3D startPoint = transform.Transform((Point3D)Vector3D.FromAngle(arc.StartAngle)); Point3D endPoint = transform.Transform((Point3D)Vector3D.FromAngle(arc.EndAngle));
- Wout
DanielM
3/5/2024 5:04 PM
Thanks, I will try it asap!
Wout
3/5/2024 5:19 PM
I updated it, I made a mistake in my first attempt! - Wout
DanielM
3/6/2024 6:35 AM
THX! Two little Helper. Works fine :D
C# Code:
/// <summary> /// Get the Start Point from <paramref name="arc"/>. /// </summary> /// <param name="arc"></param> /// <returns></returns> public static Point3D GetStartPoint(DxfArc arc) { Matrix4D transform = arc.Transform * Transformation4D.Translation((Vector3D)arc.Center) * Transformation4D.Scaling(arc.Radius); return transform.Transform((Point3D)Vector3D.FromAngle(arc.StartAngle)); } /// <summary> /// Get the End Point from <paramref name="arc"/>. /// </summary> /// <param name="arc"></param> /// <returns></returns> public static Point3D GetEndPoint(DxfArc arc) { Matrix4D transform = arc.Transform * Transformation4D.Translation((Vector3D)arc.Center) * Transformation4D.Scaling(arc.Radius); return transform.Transform((Point3D)Vector3D.FromAngle(arc.EndAngle)); }
1