/// <summary> /// Tests for intersection between a <see cref="Sphere"/> and an <see cref="AxisAlignedBox"/> . /// </summary> /// <param name="sphere">A <see cref="Sphere"/> instance.</param> /// <param name="box">An <see cref="AxisAlignedBox"/> instance.</param> /// <returns>An <see cref="IntersectionType"/> value.</returns> public static IntersectionType Intersects(Sphere sphere, AxisAlignedBox box) { // TODO: Implement this. throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="AxisAlignedBox"/> class using given values from another box instance. /// </summary> /// <param name="box">A <see cref="AxisAlignedBox"/> instance to take values from.</param> public AxisAlignedBox(AxisAlignedBox box) { _min = box.Min; _max = box.Max; }
/// <summary> /// Tests for intersection between two <see cref="AxisAlignedBox"/> instances. /// </summary> /// <param name="box1">An <see cref="AxisAlignedBox"/> instance.</param> /// <param name="box2">An <see cref="AxisAlignedBox"/> instance.</param> /// <returns>An <see cref="IntersectionType"/> value.</returns> public static IntersectionType Intersects(AxisAlignedBox box1, AxisAlignedBox box2) { Vector3F min1 = box1.Min; Vector3F max1 = box1.Max; Vector3F min2 = box2.Min; Vector3F max2 = box2.Max; if ((min2.X > min1.X) && (max2.X < max1.X) && (min2.Y > min1.Y) && (max2.Y < max1.Y) && (min2.Z > min1.Z) && (max2.Z < max1.Z)) { // box2 contains box1 return IntersectionType.Contained; } if ((min2.X > max2.X) || (min2.Y > max2.Y) || (min2.Z > max2.Z) || (max2.X < min1.X) || (max2.Y < min1.Y) || (max2.Z < min1.Z)) { // The two boxes are not intersecting. return IntersectionType.None; } // if we got this far, they are partially intersecting return IntersectionType.Partial; }
/// <summary> /// Tests for intersection between an <see cref="AxisAlignedBox"/> and an <see cref="OrientedBox"/> . /// </summary> /// <param name="box1">An <see cref="AxisAlignedBox"/> instance.</param> /// <param name="box2">An <see cref="OrientedBox"/> instance.</param> /// <returns>An <see cref="IntersectionType"/> value.</returns> public static IntersectionType Intersects(AxisAlignedBox box1, OrientedBox box2) { // TODO: Implement this. throw new NotImplementedException(); }
/// <summary> /// Tests for intersection between a <see cref="Ray"/> and an <see cref="AxisAlignedBox">axis aligned box</see>. /// </summary> /// <param name="ray">A <see cref="Ray"/> instance.</param> /// <param name="aabb">A <see cref="AxisAlignedBox"/> instance.</param> /// <returns>An <see cref="IntersectionPair"/> instance containing the intersection information.</returns> public static IntersectionPair Intersects(Ray ray, AxisAlignedBox aabb) { // TODO: Implement this. throw new NotImplementedException(); }