public void TestToConicalFrustum() { // Define variables and constants // Set up context // Execute // Assert outcome Assert.AreEqual(new Cone(0f, 5f, 0f, 6f, 10f, 6f), testCylinderA.ToSymmetricalConicalFrustum()); Assert.AreEqual(new Cone(0f, 1f, 0f, 11f, 2f, 11f), testCylinderB.ToSymmetricalConicalFrustum()); Assert.AreEqual(new Cone(10f, -5f, 5f, 10f, 10f, 10f), testCylinderC.ToSymmetricalConicalFrustum()); Assert.AreEqual(new Cone(4f, 5f, 6f, 0f, 0f, 0f), testCylinderD.ToSymmetricalConicalFrustum()); Assert.AreEqual(new Cone(1f, 4f, 3f, 5f, 4f, 5f), testCylinderE.ToSymmetricalConicalFrustum()); }
/// <summary> /// Indicates whether or not the given shape is contained entirely within this sphere (no part of the <paramref name="other"/> /// shape may be outside this one). /// </summary> /// <param name="other">The shape to check.</param> /// <returns>True if the other shape is completely within this sphere, false if any part of it /// is outside the sphere.</returns> public bool Contains(Cylinder other) { return(Contains(other.ToSymmetricalConicalFrustum())); }
/// <summary> /// Indicates whether any portion of this cone and the <paramref name="other"/> shape overlap. /// </summary> /// <param name="other">The shape to check against this one.</param> /// <returns>True if any part of both shapes overlap, false if they are entirely separate.</returns> public bool Intersects(Cylinder other) { return(other.ToSymmetricalConicalFrustum().Intersects(this)); }