本文整理汇总了C#中Vector.IsPerpendicular方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.IsPerpendicular方法的具体用法?C# Vector.IsPerpendicular怎么用?C# Vector.IsPerpendicular使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.IsPerpendicular方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Project
/// <summary>
/// Constructors a point by projecting a point on a plane with given project direction.
/// </summary>
/// <param name="contextPlane">Plane of projection</param>
/// <param name="direction">Projection direction</param>
/// <returns>Point</returns>
public Point Project(Plane contextPlane, Vector direction)
{
if (contextPlane == null)
{
throw new ArgumentNullException("contextPlane");
}
else if (direction == null)
{
throw new ArgumentNullException("direction");
}
else if (direction.IsZeroVector())
{
throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
}
else if (direction.IsPerpendicular(contextPlane.Normal))
{
throw new ArgumentException(string.Format(Properties.Resources.IsParallel, "contextPlane", "direction", "Point.Project"));
}
var pt = contextPlane.Project(this, direction);
pt.Context = contextPlane;
pt.ReferencePoint = this;
pt.Direction = direction;
pt.Persist();
return pt;
}
示例2: ByOriginVectors
internal static CoordinateSystem ByOriginVectors(Point origin, Vector xAxis, Vector yAxis, Vector zAxis,
bool isSheared, bool isNormalized, bool visible)
{
if (origin == null)
throw new System.ArgumentNullException("origin");
else if (xAxis == null)
throw new System.ArgumentNullException("xAxis");
else if (yAxis == null)
throw new System.ArgumentNullException("yAxis");
else if (zAxis == null)
throw new System.ArgumentNullException("zAxis");
else if (xAxis.IsZeroVector())
throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroVector, "x axis"), "xAxis");
else if (yAxis.IsZeroVector())
throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroVector, "y axis"), "yAxis");
else if (zAxis.IsZeroVector())
throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroVector, "z axis"), "zAxis");
else if (xAxis.IsParallel(yAxis))
throw new System.ArgumentException(string.Format(Properties.Resources.IsParallel, "x axis", "y axis", "CoordinateSystem.ByOriginVectors"), "xAxis, yAxis");
else if (!isSheared && (!xAxis.IsPerpendicular(yAxis) || !yAxis.IsPerpendicular(zAxis) || !zAxis.IsPerpendicular(xAxis)))
{
// this is not the case for sheared but axes are not orthogonal
//
zAxis = xAxis.Cross(yAxis);
yAxis = zAxis.Cross(xAxis);
}
if (isNormalized)
{
xAxis = xAxis.Normalize();
yAxis = yAxis.Normalize();
zAxis = zAxis.Normalize();
}
var cs = HostFactory.Factory.CoordinateSystemByData(null); //create identity matrix
if (null == cs)
throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "CoordinateSystem.ByOriginVectors"));
cs.Set(origin.PointEntity, xAxis.IVector, yAxis.IVector, zAxis.IVector);
var coordSys = new CoordinateSystem(cs, visible);
return coordSys;
}
示例3: Project
/// <summary>
/// Returns the projection of the curve on the plane with given direction
/// Argument Requirement:
/// direction.Length > 0
/// </summary>
/// <param name="contextPlane">Projection plane</param>
/// <param name="direction">Projection direction</param>
/// <returns>Projected curve on the context plane</returns>
public Curve Project(Plane contextPlane, Vector direction)
{
string kMethodName = "Curve.Project";
if (null == contextPlane)
throw new System.ArgumentNullException("contextPlane");
else if (null == direction)
throw new System.ArgumentNullException("direction");
if (direction.Length.EqualsTo(0.0))
throw new System.ArgumentException(string.Format(Properties.Resources.IsZero, "length of the direction vector"), "direction");
if (direction.IsPerpendicular(contextPlane.Normal))
return null;
ICurveEntity entity = CurveEntity.ProjectOn(contextPlane.PlaneEntity, direction.IVector);
if (null == entity)
throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));
return entity.ToCurve(true, this);
}