Constructs the point of intersection between two lines defined by the input points and angles (in radians).
[Visual Basic .NET] Public Sub ConstructAngleIntersection ( _ ByVal p1 As IPoint, _ ByVal angle1 As Double, _ ByVal p2 As IPoint, _ ByVal angle2 As Double _ )
[C#] public void ConstructAngleIntersection ( IPoint p1, double angle1, IPoint p2, double angle2 );
[C++]
HRESULT ConstructAngleIntersection(
IPoint* p1,
double angle1,
IPoint* p2,
double angle2
);
[C++]Parameters
p1p1 is a parameter of type IPoint
angle1 angle1 is a parameter of type double p2p2 is a parameter of type IPoint
angle2 angle2 is a parameter of type double
Product Availability
Remarks
Angles are specified as geometric angles measured counterclockwise from the positive x axis of the Cartesian coordinate system. All angles are specified in radians .
//This method constructs a new point as intersection of 2 lines
public void ConstructAngleIntersection()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(100, 0);
double angle1Rad = 45 * 2 * Math.PI / 360;
double angle2Rad = 135 * 2 * Math.PI / 360;
IConstructPoint constructionPoint = new PointClass();
constructionPoint.ConstructAngleIntersection(fromPoint, angle1Rad, toPoint, angle2Rad);
IPoint outPutPoint = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint.X + " , " + outPutPoint.Y);
}
'+++ Construct a new point as intersection of 2 lines
Public Sub t_ConstructAngleIntersection()
On Error GoTo Errorhandler
Dim pPoint1 As ESRI.ArcGIS.Geometry.IPoint
Dim pPoint2 As ESRI.ArcGIS.Geometry.IPoint
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim dAngle1 As Long
Dim dAngle2 As Long
pPoint1 = New ESRI.ArcGIS.Geometry.Point
pPoint2 = New ESRI.ArcGIS.Geometry.Point
pPoint1.PutCoords(0, 0)
pPoint2.PutCoords(100, 0)
dAngle1 = 45
dAngle2 = 135
pPoint = ptConstructAngleIntersection(pPoint1, dAngle1, pPoint2, dAngle2)
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
Public Function ptConstructAngleIntersection(ByVal pPt1 As ESRI.ArcGIS.Geometry.IPoint, ByVal dAngle1 As Long, ByVal pPt2 As ESRI.ArcGIS.Geometry.IPoint, ByVal dAngle2 As Long) As ESRI.ArcGIS.Geometry.IPoint
Const PI As Double = 3.14159265358979
Dim dAngleRad1 As Double
Dim dAngleRad2 As Double
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
pCPoint = New ESRI.ArcGIS.Geometry.Point
dAngleRad1 = dAngle1 * 2 * PI / 360 ' Conversion degrees to radians
dAngleRad2 = dAngle2 * 2 * PI / 360
pCPoint.ConstructAngleIntersection(pPt1, dAngleRad1, pPt2, dAngleRad2)
ptConstructAngleIntersection = pCPoint
End Function