IntCubeLike

A three dimensional cube.

Wikipedia: "Usually, the octant with all three positive coordinates is referred to as the first octant. There is no generally used naming convention for the other seven octants."

However the article suggests (given that we count from zero):

  • 0 (binary 000) - top-front-left
  • 1 (binary 001) - top-back-right
  • 2 (binary 010) - top-back-left
  • 3 (binary 011) - top-front-left
  • 4 (binary 100) - bottom-front-left
  • 5 (binary 101) - bottom-back-left
  • 6 (binary 110) - bottom-back-right
  • 7 (binary 111) - bottom-front-right

Obviously there is no clear connection between the orientation and the binary representation. We thus prefer to chose the the octants numbering in a binary fashion, assigning bit 0 to the x-axis, bit 1 to the y-axis, and bit 2 to the z-axis, where top-front-left is 000, hence:

  • 0 (binary 000) - left-top-front
  • 1 (binary 001) - right-top-front
  • 2 (binary 010) - left-bottom-front
  • 3 (binary 011) - right-bottom-front
  • 4 (binary 100) - left-top-back
  • 5 (binary 101) - right-top-back
  • 6 (binary 110) - left-bottom-back
  • 7 (binary 111) - right-bottom-back
class Object
trait Matchable
class Any
class IntCube

Value members

Abstract methods

def cx: Int

X coordinate of the cube's center

X coordinate of the cube's center

def cy: Int

Y coordinate of the cube's center

Y coordinate of the cube's center

def cz: Int

Z coordinate of the cube's center

Z coordinate of the cube's center

def extent: Int

The extent is the half side length of the cube

The extent is the half side length of the cube

Concrete methods

final def area: BigInt
final def back: Int
final def bottom: Int
final def containsH(cube: HyperCube): Boolean
final def containsP(point: PointLike): Boolean
final def front: Int
final def indexOfH(b: HyperCube): Int
final def indexOfP(a: PointLike): Int
final def isAreaGreater(a: HyperCube, b: BigInt): Boolean
final def isAreaNonEmpty(area: BigInt): Boolean
final def left: Int
final def maxDistance(point: PointLike): Double
final def maxDistanceSq(point: PointLike): BigInt

Calculates the maximum squared euclidean distance to a point in the euclidean metric. This is the distance (squared) to the corner which is the furthest from the point, no matter if it lies within the hyper-cube or not.

Calculates the maximum squared euclidean distance to a point in the euclidean metric. This is the distance (squared) to the corner which is the furthest from the point, no matter if it lies within the hyper-cube or not.

final def minDistance(point: PointLike): Double
final def minDistanceSq(point: PointLike): BigInt

The squared (euclidean) distance of the closest of the cube's corners or sides to the point, if the point is outside the cube, or zero, if the point is contained

The squared (euclidean) distance of the closest of the cube's corners or sides to the point, if the point is outside the cube, or zero, if the point is contained

final def orthant(idx: Int): HyperCube
final def overlapArea(b: HyperCube): BigInt
final def right: Int
final def top: Int