本文整理汇总了C#中Point3d.GetVectorTo方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.GetVectorTo方法的具体用法?C# Point3d.GetVectorTo怎么用?C# Point3d.GetVectorTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3d
的用法示例。
在下文中一共展示了Point3d.GetVectorTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Drag
/// <summary>
/// Перемещение объектов
/// Открытая транзакция не требуется
/// При отмене пользователем - объекты удаляются
/// </summary>
/// <param name="ed"></param>
/// <param name="ids"></param>
/// <param name="pt"></param>
/// <returns></returns>
public static bool Drag(this Editor ed, ObjectId[] ids, Point3d pt)
{
if (ids == null || !ids.Any()) return false;
SelectionSet selSet = SelectionSet.FromObjectIds(ids);
PromptPointResult ppr = ed.Drag(selSet, "\nТочка вставки:", (Point3d ptInput, ref Matrix3d mat) =>
{
if (ptInput.IsEqualTo(pt)) return SamplerStatus.NoChange;
mat = Matrix3d.Displacement(pt.GetVectorTo(ptInput));
//pt = ptInput;
return SamplerStatus.OK;
});
if (ppr.Status == PromptStatus.OK)
{
using (var t = ed.Document.TransactionManager.StartTransaction())
{
foreach (var item in ids)
{
var mat = Matrix3d.Displacement(pt.GetVectorTo(ppr.Value));
var ent = item.GetObject(OpenMode.ForWrite, false, true) as Entity;
ent.TransformBy(mat);
}
t.Commit();
}
return true;
}
else
{
using (var t = ed.Document.TransactionManager.StartTransaction())
{
foreach (var id in ids)
{
var ent = id.GetObject(OpenMode.ForWrite);
ent.Erase();
}
t.Commit();
}
return false;
}
}
示例2: DrawBeamSlab
/// <summary>
/// 绘制梁图
/// </summary>
private void DrawBeamSlab()
{
supportPointsL = new List<Point3d>();
supportPointsR = new List<Point3d>();
//---如果是调试位置,可以打开图块的外边框 IsDrawBlockBorder = true;
if (user_curveZX == null || user_cvBoardUp == null || user_cvBoardDn == null || user_pierline1 == null || user_pierline2 == null)
{
System.Windows.Forms.MessageBox.Show("未选择线。");
return;
}
xPoint1 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline1);
xPoint2 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline2);
Vector3d vectRotate1 = xPoint1.GetVectorTo(xPoint2);
//double rotate1Angle = vectRotate1.AngleOnPlane(user_curveZX.GetPlane());
rotate1Angle = AcadAssist.AngleOnPlan(vectRotate1, user_curveZX);
curveZX2 = AcadAssist.ConvertToTxPolyline(user_curveZX);
cvBoardUp2 = AcadAssist.ConvertToTxPolyline(user_cvBoardUp);
cvBoardDn2 = AcadAssist.ConvertToTxPolyline(user_cvBoardDn);
pierline12 = (TxLine)user_pierline1.Clone();
pierline22 = (TxLine)user_pierline2.Clone();
curveZX2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
cvBoardUp2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
cvBoardDn2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
pierline12.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
pierline22.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
m_storeCLines2 = new List<TxLine>();
for (int i = 0; i < user_storedCLines.Count; i++)
{
m_storeCLines2.Add((TxLine)user_storedCLines[i].Clone());
m_storeCLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1));
}
m_hgbLines2 = new List<TxLine>();
for (int i = 0; i < user_hgbLines.Count; i++)
{
m_hgbLines2.Add((TxLine)user_hgbLines[i].Clone());
m_hgbLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1));
}
if (curveZX2.StartPoint.X > curveZX2.EndPoint.X)
curveZX2 = AcadAssist.ReverseTxPolyline(curveZX2);
if (cvBoardUp2.StartPoint.X > cvBoardUp2.EndPoint.X)
cvBoardUp2 = AcadAssist.ReverseTxPolyline(cvBoardUp2);
if (cvBoardDn2.StartPoint.X > cvBoardDn2.EndPoint.X)
cvBoardDn2 = AcadAssist.ReverseTxPolyline(cvBoardDn2);
if (pierline12.StartPoint.Y > pierline12.EndPoint.Y)
pierline12 = AcadAssist.ReverseTxLine(pierline12);
if (pierline22.StartPoint.Y > pierline22.EndPoint.Y)
pierline22 = AcadAssist.ReverseTxLine(pierline22);
try
{
#region 绘制总体构造信息 [道路设计线,伸缩缝中心线,桩号,墩号,墩位,板梁端部线]
//-------------前面还有个中心线的相交-------不相交有没有处理过,是不是已经延长过了,不记得了;这个是新加上的----------
List<Point3d> milePoints1 = AcadAssist.GetIntersectionPoints(curveZX2, pierline12);
List<Point3d> milePoints2 = AcadAssist.GetIntersectionPoints(curveZX2, pierline22);
if (milePoints1.Count == 0 || milePoints2.Count == 0) System.Windows.Forms.MessageBox.Show("分控线和桥梁边线没有交点");
milePoint1 = AcadAssist.GetIntersectionPoint(curveZX2, pierline12);
milePoint2 = AcadAssist.GetIntersectionPoint(curveZX2, pierline22);
//伸缩缝中心线线转化为线段
pierline1x = AcadAssist.LineToBorder(pierline12, cvBoardUp2, cvBoardDn2);
pierline2x = AcadAssist.LineToBorder(pierline22, cvBoardUp2, cvBoardDn2);
//道路设计线
block.AddLine(pierline1x, CommonLayer.cenlayer);
block.AddLine(pierline2x, CommonLayer.cenlayer);
TxCurve centerLine = AcadAssist.CurveToBorder(curveZX2, pierline12, pierline22);
Point3d centerLineMidPoint = centerLine.GetPointAtDist(centerLine.GetDistAtPoint(centerLine.EndPoint) * 0.7);
Vector3d centerLineMidVect = AcadAssist.GetFirstDerivative(centerLine, centerLineMidPoint);
centerLine = AcadAssist.ExtendCurve(centerLine, 8 * block.style.BlockScale);
block.AddCurve(centerLine, CommonLayer.cenlayer);
//板梁端部线 [伸缩缝附近横桥向端线]
endLine1 = AcadAssist.OffsetLineToBoarder(pierline12, -m_glWidth1 * m_drawScale, cvBoardUp2, cvBoardDn2);
endLine2 = AcadAssist.OffsetLineToBoarder(pierline22, +m_glWidth2 * m_drawScale, cvBoardUp2, cvBoardDn2);
if (endLine1.StartPoint.Y > endLine1.EndPoint.Y) endLine1 = AcadAssist.ReverseTxLine(endLine1);
if (endLine2.StartPoint.Y > endLine2.EndPoint.Y) endLine2 = AcadAssist.ReverseTxLine(endLine2);
//空心板横桥向端线
block.AddLine(endLine1, CommonLayer.gz1layer);
block.AddLine(endLine2, CommonLayer.gz1layer);
//转角---以后对齐,标注等都要用
TxLine alignLine = new TxLine(AcadAssist.Mid(endLine1.StartPoint, endLine1.EndPoint), AcadAssist.Mid(endLine2.StartPoint, endLine2.EndPoint));
Vector3d vectRotate = alignLine.StartPoint.GetVectorTo(alignLine.EndPoint);
startLineAngle = AcadAssist.AngleOnPlan(vectRotate, alignLine);
#endregion
//.........这里部分代码省略.........
示例3: IsBetween
/// <summary>
/// Gets a value indicating whether the specified point is on the segment defined by two points.
/// </summary>
/// <param name="pt">The instance to which the method applies.</param>
/// <param name="p1">The segment start point.</param>
/// <param name="p2">The segment end point.</param>
/// <param name="tol">The tolerance used in comparisons.</param>
/// <returns>true if the point is on the segment; otherwise, false.</returns>
public static bool IsBetween(this Point3d pt, Point3d p1, Point3d p2, Tolerance tol)
{
return p1.GetVectorTo(pt).GetNormal(tol).Equals(pt.GetVectorTo(p2).GetNormal(tol));
}
示例4: AdjustSjfW
/// <summary>
/// 微调湿接缝宽度--初次布板湿接缝递增或递减,现将其调匀
/// </summary>
private List<Point3d> AdjustSjfW(Point3d start, Point3d end, int segCount, List<double> adjustSjfW)
{
double seglength = start.DistanceTo(end) / segCount;
Vector3d vect = start.GetVectorTo(end).GetNormal();
List<Point3d> res = new List<Point3d>();
double dist = 0;
for (int i = 1; i < segCount; i++)
{
dist += (seglength + adjustSjfW[i - 1]);
res.Add(start + vect.MultiplyBy(dist));
}
return res;
}