Hello Esri Team & Community,
I need help creating a tangent curve. I only have two length (arc length and chord length) and a tangent bearing.
I need help with finding an equivalent API in ArcGIS Pro. In ArcObject, we have:
/// <summary>Constructs an arc with a common tangent to the input segment, a given chord length and an arc length.</summary>
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void ConstructTangentChordArc(
[MarshalAs(UnmanagedType.Interface)] ISegment Segment,
bool atStart,
bool isCCW,
double chordDistance,
double arcDistance);
Would you guys happen to know?
Thank you,
Trushar
Hi,
Take a look at ArcGIS Pro SDK API reference EllipticArcBuilderEx method
Thank you but I checked all the overloads there with no success.
There are 2 differences in parameters in my suggested method:
1. isCCW type is bool and orientation type - ArcOrientation. isCCW = true equals ArcOrientation.ArcCounterClockwise, isCCW=false equals ArcOrientation.ArcClockwise.
2. ArcGIS Pro has additional parameter of type SpatialReference, but it is optional. You can pass null.
Could you share your code or export segment to csv to check?
Hello Gintauta,
The link you referred has method that takes radius and arc:
public EllipticArcBuilderEx( Segment tangentSegment, bool atStart, ArcOrientation orientation, double radius, double arcLength, SpatialReference spatialReference )
My input parameters are chord and arc.
Here is my solution to this problem but it give invalid results:
private static EllipticArcSegment CircularArcFromArcAndChordWithTangentBearing(
[NotNull] MetesAndBoundsEllipticCurveDrawDesc.IStandardizedDistance arcLength,
[NotNull] MetesAndBoundsEllipticCurveDrawDesc.IStandardizedDistance chordLength,
[NotNull] Segment previousSegment,
ArcOrientation orientation)
{
var arcLengthInMeters = (double)arcLength.Distance * LinearUnitExtensions.GetRatio<Meter>();
var chordLengthInMeters = (double)chordLength.Distance * LinearUnitExtensions.GetRatio<Meter>();
// until Esri provide similar API access to get center angle from
// IConstructCircularArc.ConstructBearingChordArc().CentralAngle
// which we can feed in MetesAndBoundsPathGenerator.ChordDirection()
// to get chord bearing
// calculate the radius of a circle if you know the length of a chord (c) and
// the length of the corresponding arc (s) that the chord subtends.
// To calculate the radius, you can use the following formula:
// Radius (r) = (c^2) / (8s) + (s/2)
// Where:
// Radius (r) is the radius of the circle.
// Chord Length (c) is the length of the chord.
// Arc Length (s) is the length of the arc that corresponds to the chord
var radiusInMeters = (chordLengthInMeters * chordLengthInMeters / (8 * arcLengthInMeters)) + (arcLengthInMeters / 2d);
// 2023-11-06 4:44pm trusharm, this is an additional step to the formula
// above to get approximate radius (pure guess)
radiusInMeters /= 2d;
using var e = new EllipticArcBuilder(
tangentSegment: previousSegment,
atStart: false,
orientation,
radiusInMeters,
arcLengthInMeters);
return e.ToSegment();
}
Thanks,
Trushar