This document is archived and information here might be outdated. Recommended version. |
Constructs a line segment being the bisector through the angle defined by the three input points.
[Visual Basic .NET] Public Sub ConstructAngleBisector ( _ ByVal from As IPoint, _ ByVal through As IPoint, _ ByVal to As IPoint, _ ByVal Length As Double, _ ByVal useAcuteAngle As Boolean _ )
[C#] public void ConstructAngleBisector ( IPoint from, IPoint through, IPoint to, double Length, bool useAcuteAngle );
[C++]
HRESULT ConstructAngleBisector(
IPoint* from,
IPoint* through,
IPoint* to,
double Length,
VARIANT_BOOL useAcuteAngle
);
[C++] Parameters from
from is a parameter of type IPoint* through
through is a parameter of type IPoint* to
to is a parameter of type IPoint* Length
Length is a parameter of type double useAcuteAngle
useAcuteAngle is a parameter of type bool
Constructs a Line segment of given input Length which bisects the Angle formed by the right side of the three input points. The From Point of the new Line is the Through input point. If the right side angle is smaller, the constructed Line will always bisect this angle, regardless of the value of bUseSmallerAngle. However, if the right side angle is larger, and bUseSmallerAngle is TRUE, then the constructed line will bisect the smaller angle (left side) instead of the right side reflex angle.
// This example constructs a new line using the ConstructAngleBisector method.
// Note the usage of the acute angle.
public void ConstructLineFromAngleBisector()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(1, 0);
IPoint throughPoint = new PointClass();
throughPoint.PutCoords(1, 1);
IPoint toPoint = new PointClass();
toPoint.PutCoords(0, 1);
IConstructLine constructLine = new LineClass();
double distance = 1.4142135623731;
constructLine.ConstructAngleBisector(fromPoint, throughPoint, toPoint, distance, false);
ILine line = constructLine as ILine;
printProperties(line);
// Now use the the acute angle with the same data.
//Gives same results as setting dDist to -1.4142135623731 and not using
// the acute angle.
constructLine.ConstructAngleBisector(fromPoint, throughPoint, toPoint, distance, true);
ILine line2 = constructLine as ILine;
printProperties(line2);
}
private void printProperties(ILine line)
{
IPoint outFromPoint = new PointClass();
IPoint outToPoint = new PointClass();
line.QueryCoords(outFromPoint, outToPoint);
System.Windows.Forms.MessageBox.Show(outFromPoint.X + " , " +
outFromPoint.Y + " , " +
outToPoint.X + " , " +
outToPoint.Y + "\n" +
"angle = " + line.Angle);
}
'+++ This example constructs a new line using the ConstructAngleBisector method.
'+++ Note the usage of the acute angle.
Public Sub t_Line_ConstructAngleBisector()
On Error GoTo Errorhandler
Dim pPointFrom As IPoint
Dim pPointTo As IPoint
Dim pPointThrough As IPoint
Dim pLine As ILine
Dim pCLine As IConstructLine
Dim dDist As Double
Dim pP1 As IPoint
Dim pP2 As IPoint
pPointFrom = New Point
pPointTo = New Point
pPointThrough = New Point
pLine = New Line
pCLine = New Line
pP1 = New Point
pP2 = New Point
pPointFrom.PutCoords(1, 0)
pPointTo.PutCoords(0, 1)
pPointThrough.PutCoords(1, 1)
dDist = 1.4142135623731
pCLine.ConstructAngleBisector(pPointFrom, pPointThrough, pPointTo, dDist, False)
pLine = pCLine
pLine.QueryCoords(pP1, pP2)
MsgBox(pP1.X & "," & pP1.Y & " to " & pP2.X & "," & pP2.Y _
& vbCrLf & "angle = " & pLine.Angle)
'+++ Now use the the acute angle with the same data.
'+++ Gives same results as setting dDist to -1.4142135623731 and not using
'+++ the acute angle.
pCLine.ConstructAngleBisector(pPointFrom, pPointThrough, pPointTo, dDist, True)
pLine = pCLine
pLine.QueryCoords(pP1, pP2)
MsgBox(pP1.X & "," & pP1.Y & " to " & pP2.X & "," & pP2.Y _
& vbCrLf & "angle = " & pLine.Angle)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub