本文整理汇总了C#中Vector3d.MultiplyBy方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.MultiplyBy方法的具体用法?C# Vector3d.MultiplyBy怎么用?C# Vector3d.MultiplyBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3d
的用法示例。
在下文中一共展示了Vector3d.MultiplyBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveItem
public void MoveItem()
{
if (!rutaId.IsValid && !movilId.IsValid)
{
Lab2.Selector.ObjectId("Selecciona la ruta", "",
typeof(Line), out rutaId);
Lab2.Selector.ObjectId("Selecciona el movil", "",
typeof(BlockReference), out movilId);
}
if (rutaId.IsValid && movilId.IsValid)
{
//Abrimos la geometría de la ruta
Line ruta = Lab3.DBMan.OpenEnity(rutaId) as Line;
BlockReference blkRef =
Lab3.DBMan.OpenEnity(movilId) as BlockReference;
Point3d cent =
new Point3d((blkRef.GeometricExtents.MinPoint.X +
blkRef.GeometricExtents.MaxPoint.X) / 2,
(blkRef.GeometricExtents.MinPoint.Y +
blkRef.GeometricExtents.MaxPoint.Y) / 2,
0);
//Vector de movimiento
Vector3d v = new Vector3d(
ruta.EndPoint.X - ruta.StartPoint.X,
ruta.EndPoint.Y - ruta.StartPoint.Y, 0);
//Hago unitario a mi vector
v = v.MultiplyBy(1 / ruta.Length);
v = v.MultiplyBy(d);
//Crear una matriz de transformación
Matrix3d matrix = Matrix3d.Displacement(v);
Matrix3d rotMatrix =
Matrix3d.Rotation(new Vector2d(v.X, v.Y).Angle, Vector3d.ZAxis, cent);
//Realizo la transformación del vehiculo
Lab3.DBMan.Transform(matrix, movilId);
//Se acomada al segmento regresando la rotación al origen
//Matrix3d rotMatrixOrigin =
// Matrix3d.Rotation(blkRef.Rotation * -1, Vector3d.ZAxis, cent);
//Lab3.DBMan.Transform(rotMatrixOrigin, movilId);
//Lab3.DBMan.Transform(rotMatrix, movilId);
//Modo 2 Rotando el bloque a la dirección del vector de ruta.
Lab3.DBMan.UpdateBlockRotation(new Vector2d(v.X, v.Y).Angle, movilId);
}
}
示例2: MoveItem2
public void MoveItem2()
{
ObjectId cId, lId;
if (Lab2.Selector.ObjectId("Selecciona el movil", "", typeof(Circle), out cId) &&
Lab2.Selector.ObjectId("Selecciona la ruta", "", typeof(Line), out lId))
{
Line l = Lab3.DBMan.OpenEnity(lId) as Line;
Circle c = Lab3.DBMan.OpenEnity(cId) as Circle;
Vector3d v = new Vector3d(l.EndPoint.X - l.StartPoint.X, l.EndPoint.Y - l.StartPoint.Y, 0);
v = v.MultiplyBy(d / v.Length);
Matrix3d m = Matrix3d.Displacement(v);
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Database dwg = Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction tr = dwg.TransactionManager.StartTransaction())
{
try
{
c = c.Id.GetObject(OpenMode.ForWrite) as Circle;
c.TransformBy(m);
tr.Commit();
}
catch (System.Exception exc)
{
ed.WriteMessage(exc.Message);
tr.Abort();
}
}
}
d = 50;
}
示例3: UpdateDireccion
public Vector3d UpdateDireccion()
{
Vector3d v;
if (this.ruta.GetBulgeAt(segmentoActualIndex) == 0)
{
if (pointActualCurve > 0)
pointActualCurve = 0;
v = new Vector3d(
segmentoActual.EndPoint.X - segmentoActual.StartPoint.X,
segmentoActual.EndPoint.Y - segmentoActual.StartPoint.Y,
0);
v = v.MultiplyBy(1 / this.segmentoActual.Length);
this.dir = v;
v = v.MultiplyBy(this.d * this.velocityScale);
}
else
{
Point3d centroCurva = this.ruta.GetArcSegmentAt(segmentoActualIndex).Center;
v = new Vector3d(
this.bloque.Position.X - centroCurva.X,
this.bloque.Position.Y - centroCurva.Y,
0);
PointOnCurve3d[] pts = ruta.GetArcSegmentAt(segmentoActualIndex).GetSamplePoints((int)(this.d * this.dS));
if (pointActualCurve < (int)(this.d * this.dS) && this.velocityScale >= 1f)
{
Lab3.DBMan.UpdateBlockPosition(new Point3d(pts[pointActualCurve].Point.X, pts[pointActualCurve].Point.Y, 0), mobile);
v = ruta.GetArcSegmentAt(segmentoActualIndex).GetTangent(pts[pointActualCurve].Point).Direction.Negate();
pointActualCurve++;
}
else
v = ruta.GetArcSegmentAt(segmentoActualIndex).GetTangent(pts[pointActualCurve].Point).Direction.Negate();
this.dir = v;
v = v.MultiplyBy(this.d * (1 - (this.dS / 100f)) * this.velocityScale);
}
return v;
}