//David: disabled this for now, it's probably nonsense. ///// <summary> ///// Try to fit a Box through 8 corner points. ///// The points need not be orthogonal, but they do need to be ///// in the same order as the result of GetCorners(). ///// When two or more points are coincident, ///// a solution is not guaranteed. ///// </summary> ///// <param name="corners">Corners for box.</param> ///// <returns>Box that approximates the corner points or Box.Unset on error.</returns> //internal static Box CreateFromNonOrthogonalPoints(IEnumerable<Point3d> corners) //{ // int N = 0; // Point3d[] C = Rhino.Collections.Point3dList.GetConstPointArray(corners, out N); // if (N != 8) { return Box.Unset; } // // Compute midpoints for all 6 sides. // Point3d Mx0 = 0.25 * (C[0] + C[3] + C[4] + C[7]); // Point3d Mx1 = 0.25 * (C[1] + C[2] + C[5] + C[6]); // Point3d My0 = 0.25 * (C[0] + C[1] + C[4] + C[5]); // Point3d My1 = 0.25 * (C[2] + C[3] + C[6] + C[7]); // Point3d Mz0 = 0.25 * (C[0] + C[1] + C[2] + C[3]); // Point3d Mz1 = 0.25 * (C[4] + C[5] + C[6] + C[7]); // // Compute planes on all 6 sides // Plane X0; Plane.FitPlaneToPoints(new Point3d[] { C[0], C[3], C[4], C[7] }, out X0); // Plane X1; Plane.FitPlaneToPoints(new Point3d[] { C[1], C[2], C[5], C[6] }, out X1); // Plane Y0; Plane.FitPlaneToPoints(new Point3d[] { C[0], C[1], C[4], C[5] }, out Y0); // Plane Y1; Plane.FitPlaneToPoints(new Point3d[] { C[2], C[3], C[6], C[7] }, out Y1); // Plane Z0; Plane.FitPlaneToPoints(new Point3d[] { C[0], C[1], C[2], C[3] }, out Z0); // Plane Z1; Plane.FitPlaneToPoints(new Point3d[] { C[4], C[5], C[6], C[7] }, out Z1); // // Abort if invalid planes were found. // if (!X0.IsValid) { return Box.Unset; } // if (!X1.IsValid) { return Box.Unset; } // if (!Y0.IsValid) { return Box.Unset; } // if (!Y1.IsValid) { return Box.Unset; } // if (!Z0.IsValid) { return Box.Unset; } // if (!Z1.IsValid) { return Box.Unset; } // // Center planes on midpoints // X0.Origin = Mx0; // X1.Origin = Mx1; // Y0.Origin = My0; // Y1.Origin = My1; // Z0.Origin = Mz0; // Z1.Origin = Mz1; // // unfinished // return Box.Unset; //} #endregion /// <summary> /// Check that all values in other are within epsilon of the values in this /// </summary> /// <param name="other"></param> /// <param name="epsilon"></param> /// <returns></returns> public bool EpsilonEquals(Box other, double epsilon) { return(m_plane.EpsilonEquals(other.m_plane, epsilon) && m_dx.EpsilonEquals(other.m_dx, epsilon) && m_dy.EpsilonEquals(other.m_dy, epsilon) && m_dz.EpsilonEquals(other.m_dz, epsilon)); }
public bool EpsilonEquals(Sphere other, double epsilon) { return(m_plane.EpsilonEquals(other.m_plane, epsilon) && RhinoMath.EpsilonEquals(m_radius, other.m_radius, epsilon)); }
public bool EpsilonEquals(Arc other, double epsilon) { return(RhinoMath.EpsilonEquals(m_radius, other.m_radius, epsilon) && m_plane.EpsilonEquals(other.m_plane, epsilon) && m_angle.EpsilonEquals(other.m_angle, epsilon)); }
public bool EpsilonEquals(Cone other, double epsilon) { return(m_baseplane.EpsilonEquals(other.m_baseplane, epsilon) && RhinoMath.EpsilonEquals(m_height, other.m_height, epsilon) && RhinoMath.EpsilonEquals(m_radius, other.m_radius, epsilon)); }
public bool EpsilonEquals(Torus other, double epsilon) { return(m_majorCirclePlane.EpsilonEquals(other.m_majorCirclePlane, epsilon) && RhinoMath.EpsilonEquals(m_majorRadius, other.m_majorRadius, epsilon) && RhinoMath.EpsilonEquals(m_minorRadius, other.m_minorRadius, epsilon)); }
/// <summary> /// Check that all values in other are within epsilon of the values in this /// </summary> /// <param name="other"></param> /// <param name="epsilon"></param> /// <returns></returns> public bool EpsilonEquals(Ellipse other, double epsilon) { return(m_plane.EpsilonEquals(other.m_plane, epsilon) && RhinoMath.EpsilonEquals(m_radius1, other.m_radius1, epsilon) && RhinoMath.EpsilonEquals(m_radius2, other.m_radius2, epsilon)); }
/// <summary> /// Check that all values in other are within epsilon of the values in this /// </summary> /// <param name="other"></param> /// <param name="epsilon"></param> /// <returns></returns> public bool EpsilonEquals(Rectangle3d other, double epsilon) { return(m_plane.EpsilonEquals(other.m_plane, epsilon) && m_x.EpsilonEquals(other.m_x, epsilon) && m_y.EpsilonEquals(other.m_y, epsilon)); }