public static CompareDouble ( double d1, double d2 ) : bool | ||
d1 | double | first value |
d2 | double | second value |
return | bool |
/// <summary> /// judge whether the lines are in the same horizontal plane /// </summary> /// <param name="lines">lines to be judged</param> /// <returns>is in the same horizontal plane</returns> public static bool InSameHorizontalPlane(List <Line> lines) { // all the Z coordinate of lines' start point and end point should be equal Autodesk.Revit.DB.XYZ firstPnt = lines[0].get_EndPoint(0); for (int i = 0; i < lines.Count; i++) { if (!MathUtil.CompareDouble(lines[i].get_EndPoint(0).Z, firstPnt.Z) || !MathUtil.CompareDouble(lines[i].get_EndPoint(1).Z, firstPnt.Z)) { return(false); } } return(true); }
/// <summary> /// judge whether two XYZs are equal /// </summary> /// <param name="pnt1">first XYZ</param> /// <param name="pnt2">second XYZ</param> /// <returns>is equal</returns> public static bool CompareXYZ(Autodesk.Revit.DB.XYZ pnt1, Autodesk.Revit.DB.XYZ pnt2) { return(MathUtil.CompareDouble(pnt1.X, pnt2.X) && MathUtil.CompareDouble(pnt1.Y, pnt2.Y) && MathUtil.CompareDouble(pnt1.Z, pnt2.Z)); }