本文整理汇总了C#中XYZ.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# XYZ.Equals方法的具体用法?C# XYZ.Equals怎么用?C# XYZ.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XYZ
的用法示例。
在下文中一共展示了XYZ.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEdgesOnPlane
/// <summary>
/// Given an array of edges, weeds out any edges
/// not present on the desired plane
/// </summary>
/// <param name="xyzArray">the array of edges </param>
/// <param name="normal">normal to the desired plane</param>
/// <returns>edges on the desired plane</returns>
public static EdgeArray GetEdgesOnPlane(EdgeArray edgeArray, XYZ normal)
{
EdgeArray edgesOnPlane = new EdgeArray();
for (int i = 0; i < edgeArray.Size; i++) {
IList<XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
if (normal.Equals(GeomUtils.kXAxis)) {
if (xyzArray[0].X == xyzArray[1].X) {
edgesOnPlane.Append(edgeArray.get_Item(i));
}
}
if (normal.Equals(GeomUtils.kYAxis)) {
if (xyzArray[0].Y == xyzArray[1].Y) {
edgesOnPlane.Append(edgeArray.get_Item(i));
}
}
if (normal.Equals(GeomUtils.kZAxis)) {
if (xyzArray[0].Z == xyzArray[1].Z) {
edgesOnPlane.Append(edgeArray.get_Item(i));
}
}
}
return edgesOnPlane;
}
示例2: GetEdgesOnPlaneAtOffset
/// <summary>
/// Given an array of edges, weeds out any edges
/// not present at the given offset
/// </summary>
/// <param name="edgeArray">the array of edges </param>
/// <param name="normal">normal to the desired plane</param>
/// <param name="offset">offset from the plane</param>
/// <returns>edges on a plane at given offset</returns>
public static EdgeArray GetEdgesOnPlaneAtOffset(EdgeArray edgeArray, XYZ normal, double offset)
{
EdgeArray edgesAtOffset = new EdgeArray();
edgeArray = GetEdgesOnPlane(edgeArray, normal);
for (int i = 0; i < edgeArray.Size; i++) {
IList<XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
if (normal.Equals(GeomUtils.kXAxis)) {
if ((xyzArray[0].X == offset)) {
edgesAtOffset.Append(edgeArray.get_Item(i));
}
}
if (normal.Equals(GeomUtils.kYAxis)) {
if (xyzArray[0].Y == offset) {
edgesAtOffset.Append(edgeArray.get_Item(i));
}
}
if (normal.Equals(GeomUtils.kZAxis)) {
if (xyzArray[0].Z == offset) {
edgesAtOffset.Append(edgeArray.get_Item(i));
}
}
}
return edgesAtOffset;
}
示例3: Mirror
/// <summary>
/// Given a point, mirrors it along the given axis
/// </summary>
/// <param name="point">point to mirror</param>
/// <param name="axiz">axis to mirror along</param>
/// <returns>a mirrored point</returns>
public static XYZ Mirror(XYZ point, XYZ axis)
{
XYZ Point = null;
if (axis.Equals(GeomUtils.kXAxis)) {
Point = new XYZ(point.X, -point.Y, point.Z);
}
if (axis.Equals(GeomUtils.kYAxis)) {
Point = new XYZ(-point.X, point.Y, point.Z);
}
if (axis.Equals(GeomUtils.kZAxis)) {
Point = new XYZ(point.X, point.Y, -point.Z);
}
return Point;
}
示例4: GetClosestPt
/// <summary>
/// given an array of pts, find the closest
/// pt to a given pt
/// </summary>
/// <param name="pt"></param>
/// <param name="pts"></param>
/// <returns></returns>
public static XYZ GetClosestPt(XYZ pt, System.Collections.Generic.IList<XYZ> pts)
{
XYZ closestPt = new XYZ();
Double closestDist = 0.0;
foreach( XYZ ptTemp in pts )
{
/// don't consider the pt itself
if (pt.Equals(ptTemp))
continue;
Double dist = Math.Sqrt(Math.Pow((pt.X - ptTemp.X), 2.0) +
Math.Pow((pt.Y - ptTemp.Y), 2.0) +
Math.Pow((pt.Z - ptTemp.Z), 2.0));
if (closestPt.IsZeroLength()) {
closestDist = dist;
closestPt = ptTemp;
}
else {
if (dist < closestDist) {
closestDist = dist;
closestPt = ptTemp;
}
}
}
return closestPt;
}
示例5: Greater
/// <summary>
/// Given two points and an axis, returns the
/// point with the greater value along the axis
/// </summary>
/// <param name="pt1">point 1 to compare</param>
/// <param name="pt2">point 2 to compare</param>
/// <param name="axis">axis to compare along</param>
/// <returns></returns>
public static XYZ Greater(XYZ pt1, XYZ pt2, XYZ axis)
{
XYZ pt = new XYZ();
if(axis.Equals(kXAxis)){
if (pt1.X > pt2.X)
pt = pt1;
else
pt = pt2;
}
if (axis.Equals(kYAxis)) {
if (pt1.Y > pt2.Y)
pt = pt1;
else
pt = pt2;
}
if (axis.Equals(kZAxis)) {
if (pt1.Z > pt2.Z)
pt = pt1;
else
pt = pt2;
}
return pt;
}