An 3d abstract bounded object

Introduced properties

abstract fun back: N

geometry :: Boxed3d :: back

Back bound
abstract fun front: N

geometry :: Boxed3d :: front

Front bound
fun to_mesh: Cuboid

geometry :: Boxed3d :: to_mesh

Create a Cuboid mesh with the dimension of self

Redefined properties

redef type SELF: Boxed3d[N]

geometry $ Boxed3d :: SELF

Type of this instance, automatically specialized in every class
redef fun contains(other: Boxed[N]): Bool

geometry $ Boxed3d :: contains

var a = new Box3d[Int].lbfwhd(1, 1, -1, 4, 4, 4)
redef fun intersects(other: Boxed[N]): Bool

geometry $ Boxed3d :: intersects

var a = new Box3d[Int].lbfwhd(0, 0, 0, 2, 2, 2)
redef fun padded(dist: N): Box3d[N]

geometry $ Boxed3d :: padded

Create a bounding box that encloses the actual bounding box.
redef fun to_s: String

geometry $ Boxed3d :: to_s

User readable representation of self.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
abstract fun back: N

geometry :: Boxed3d :: back

Back bound
abstract fun bottom: N

geometry :: Boxed :: bottom

Bottom bound
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun contains(other: Boxed[N]): Bool

geometry :: Boxed :: contains

Is other contained within self?
abstract fun front: N

geometry :: Boxed3d :: front

Front bound
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun intersects(other: Boxed[N]): Bool

geometry :: Boxed :: intersects

Does self intersect with other?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
abstract fun left: N

geometry :: Boxed :: left

Left bound
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun padded(dist: N): Box[N]

geometry :: Boxed :: padded

Create a bounding box that encloses the actual bounding box.
abstract fun right: N

geometry :: Boxed :: right

Right bound
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_mesh: Cuboid

geometry :: Boxed3d :: to_mesh

Create a Cuboid mesh with the dimension of self
fun to_s: String

core :: Object :: to_s

User readable representation of self.
abstract fun top: N

geometry :: Boxed :: top

Top bound
package_diagram geometry::Boxed3d Boxed3d geometry::Boxed Boxed geometry::Boxed3d->geometry::Boxed core::Object Object geometry::Boxed->core::Object ...core::Object ... ...core::Object->core::Object geometry::Box3d Box3d geometry::Box3d->geometry::Boxed3d geometry::IPoint3d IPoint3d geometry::IPoint3d->geometry::Boxed3d geometry::ILine3d ILine3d geometry::ILine3d->geometry::Boxed3d geometry::Point3d Point3d geometry::Point3d->geometry::IPoint3d geometry::Point3d... ... geometry::Point3d...->geometry::Point3d geometry::Line3d Line3d geometry::Line3d->geometry::ILine3d geometry::Line3d... ... geometry::Line3d...->geometry::Line3d

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

interface Boxed[N: Numeric]

geometry :: Boxed

An 2d abstract bounded object

Children

class Box3d[N: Numeric]

geometry :: Box3d

A 3d bounded object and an implementation of Boxed
interface ILine3d[N: Numeric]

geometry :: ILine3d

Abstract 3D line segment between two ordered points
interface IPoint3d[N: Numeric]

geometry :: IPoint3d

Abstract 3d point, strongly linked to its implementation Point3d

Descendants

class Line3d[N: Numeric]

geometry :: Line3d

3D line segment between two ordered points
class Point3d[N: Numeric]

geometry :: Point3d

3D point with x, y and z

Class definitions

geometry $ Boxed3d
# An 3d abstract bounded object
interface Boxed3d[N: Numeric]
	super Boxed[N]

	# Front bound
	#
	# require: front >= back
	fun front: N is abstract

	# Back bound
	#
	# require: back <= bottom
	fun back: N is abstract

	#     var a = new Box3d[Int].lbfwhd(1, 1, -1, 4, 4, 4)
	#     var b = new Box3d[Int].lbfwhd(2, 2, -2, 2, 2, 2)
	#     var c = new Box3d[Int].lbfwhd(2, 2,  0, 2, 2, 8)
	#     assert a.contains(b)
	#     assert not b.contains(a)
	#     assert c.contains(b)
	#     assert not b.contains(c)
	#     assert not a.contains(c)
	#     assert not c.contains(a)
	redef fun contains(other)
	do
		return super and (not other isa Boxed3d[N] or
			(self.front >= other.front and self.back <= other.back))
	end

	#     var a = new Box3d[Int].lbfwhd(0, 0, 0, 2, 2, 2)
	#     var b = new Box3d[Int].lbfwhd(1, 1, 1, 8, 2, 2)
	#     var c = new Box3d[Int].lbfwhd(3, 0, 0, 2, 2, 8)
	#     assert a.intersects(b)
	#     assert b.intersects(a)
	#     assert b.intersects(c)
	#     assert c.intersects(b)
	#     assert not c.intersects(a)
	#     assert not a.intersects(c)
	redef fun intersects(other)
	do
		return super and (not other isa Boxed3d[N] or
			(self.back <= other.front and other.back <= self.front))
	end

	redef fun padded(dist): Box3d[N] do return new Box3d[N].lrtbfb(left - dist, right + dist, top + dist, bottom - dist, front + dist, back - dist)

	redef fun to_s do return "<{class_name} left: {left}, right: {right}, top: {top}, bottom: {bottom}, front: {front}, back: {back}>"
end
lib/geometry/boxes.nit:153,1--200,3

gamnit :: more_meshes $ Boxed3d
redef class Boxed3d[N]
	# Create a `Cuboid` mesh with the dimension of `self`
	#
	# Does not use the position of `self`, but it can be given to an `Actor`.
	fun to_mesh: Cuboid
	do
		var width = right.to_f-left.to_f
		var height = top.to_f-bottom.to_f
		var depth = front.to_f-back.to_f
		return new Cuboid(width, height, depth)
	end
end
lib/gamnit/depth/more_meshes.nit:163,1--174,3