Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.video.collision_detection

Class EM_COLLISION_DETECTOR_3D



Creation

Features

Invariants

indexing

description

The class EM_COLLISION_DETECTOR_3D is used to check whether two EM_COLLIDABLE_3D
are collided or not. It is a container. You can add an EM_COLLIDABLE_3D
with the command add and remove one with the command remove. If you call
check_for_collision the command checks if there is a collision and calls
on_collide command of either both of the collided objects if call_both is
true or one of the commands otherwise. Make sure, that ALL of the EM_COLLIDABLE_3D
objects added to the container are of the same type, because CAT calls
are used.

date

$Date: 2005/10/23 10:49:44 $

revision

$Revision: 1.2 $

class

EM_COLLISION_DETECTOR_3D

create

make

-- Create a ESDL_COLLISION_DETECTOR

ensure
call_both_true: call_both = true

feature -- Status

call_both: BOOLEAN

-- Are both on_collide routines called if two elements collide or only one of them?

set_call_both (b: BOOLEAN)

-- Sets call_both to b

ensure
set: call_both = b

feature -- Commands

add (a_collidable: EM_COLLIDABLE_3D)

-- Adds a_collidable to test it for collision with the all other elements

require
a_collidable_not_void: a_collidable /= void
check_for_collision

-- Checks if any element collides with any other element O(n*(n-1)*(n-2)*...*1)
-- If so calls both on_collide if call_both is true or any of them if not.

remove (a_collidable: EM_COLLIDABLE_3D )

-- Removes a_collidable

require
a_collidable_not_void: a_collidable /= void

invariant

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end