Welcome to the NetCologne GmbH open source mirroring service!

This machine mirrors various open-source projects. 20 Gbit/s uplink.

If there are any issues or you want another project mirrored, please contact mirror-service -=AT=- netcologne DOT de !

World class Reference
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

World Class Reference

#include <world.hxx>

Collaboration diagram for World:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< Collider * > Colliders
typedef std::vector< Spring
* >::iterator 
SpringIter
typedef std::vector< Spring
* >::const_iterator 
CSpringIter

Public Member Functions

 World ()
 World (const World &w)
 World (const std::string &filename)
 ~World ()
void draw (ZoomGraphicContext *gc)
void draw_springs (ZoomGraphicContext *gc)
void draw_colliders (ZoomGraphicContext *gc)
void draw_particles (ZoomGraphicContext *gc)
void update (float delta)
World * duplicate ()
Particleget_particle (float x, float y)
std::vector< Particle * > get_particles (float x1, float y1, float x2, float y2)
Springget_spring (float x, float y)
void add_rect_collider (const Vector2d &, const Vector2d &)
void add_spring (Particle *, Particle *)
void remove_particle (Particle *)
void remove_spring (Spring *)
void remove_collider (Collider *)
ParticleFactoryget_particle_mgr ()
std::vector< Spring * > & get_spring_mgr ()
Collidersget_colliders ()
void clear ()
bool get_has_been_run ()
void zero_out_velocity ()
void write_lisp (const std::string &filename)
int get_num_particles ()
int get_num_springs ()
WorldBoundingBox calc_bounding_box ()

Static Public Member Functions

World * current ()

Friends

class ParticleFactory

Detailed Description

This class holds all particles and springs

Definition at line 41 of file world.hxx.


Member Typedef Documentation

typedef std::vector<Collider*> World::Colliders
 

Definition at line 44 of file world.hxx.

typedef std::vector<Spring*>::const_iterator World::CSpringIter
 

Definition at line 46 of file world.hxx.

Referenced by World(), and write_lisp().

typedef std::vector<Spring*>::iterator World::SpringIter
 

Definition at line 45 of file world.hxx.

Referenced by clear(), draw_springs(), get_spring(), remove_particle(), and update().


Constructor & Destructor Documentation

World::World  
 

Create an empty world

Definition at line 40 of file world.cxx.

Referenced by duplicate().

World::World const World &    w
 

Copy an existing world

Definition at line 230 of file world.cxx.

References colliders, CSpringIter, ParticleFactory::lookup_particle(), particle_mgr, ParticleFactory, and springs.

World::World const std::string &    filename
 

load a world from file

Definition at line 47 of file world.cxx.

References ConstruoAssert, StringUtils::has_suffix(), lisp_car(), lisp_cdr(), lisp_free(), lisp_read(), lisp_stream_init_file(), lisp_stream_init_string(), lisp_symbol(), lisp_symbol_p, LISP_TYPE_EOF, LISP_TYPE_PARSE_ERROR, SystemContext::open_input_file(), system_context, SystemContext::translate_filename(), and _lisp_object_t::type.

World::~World  
 

Definition at line 261 of file world.cxx.

References clear().


Member Function Documentation

void World::add_rect_collider const Vector2d  ,
const Vector2d  
 

Definition at line 667 of file world.cxx.

References Vector2d::x, Rect< T >::x1, Rect< T >::x2, Vector2d::y, Rect< T >::y1, and Rect< T >::y2.

Referenced by WorldViewColliderTool::on_primary_button_release().

void World::add_spring Particle  ,
Particle  
 

Definition at line 482 of file world.cxx.

Referenced by Selection::duplicate(), and WorldViewInsertTool::on_primary_button_press().

WorldBoundingBox World::calc_bounding_box  
 

Definition at line 624 of file world.cxx.

References ParticleFactory::begin(), ParticleFactory::end(), Math::max(), Math::min(), ParticleFactory::ParticleIter, ParticleFactory::size(), WorldBoundingBox::x1, WorldBoundingBox::x2, WorldBoundingBox::y1, and WorldBoundingBox::y2.

Referenced by WorldViewComponent::draw(), and WorldButton::draw().

void World::clear  
 

removes everything from the world

Definition at line 530 of file world.cxx.

References ParticleFactory::clear(), and SpringIter.

Referenced by ~World().

World* World::current   [inline, static]
 

Returns:
pointer to the current world

Definition at line 125 of file world.hxx.

void World::draw ZoomGraphicContext   gc
 

Definition at line 267 of file world.cxx.

References draw_colliders(), draw_particles(), and draw_springs().

void World::draw_colliders ZoomGraphicContext   gc
 

Definition at line 310 of file world.cxx.

Referenced by WorldViewComponent::draw(), WorldButton::draw(), and draw().

void World::draw_particles ZoomGraphicContext   gc
 

Definition at line 304 of file world.cxx.

References ParticleFactory::draw().

Referenced by WorldViewComponent::draw(), and draw().

void World::draw_springs ZoomGraphicContext   gc
 

Definition at line 277 of file world.cxx.

References ZoomGraphicContext::draw_lines(), Vector2d::norm(), SpringIter, Vector2d::x, and Vector2d::y.

Referenced by WorldViewComponent::draw(), WorldButton::draw(), and draw().

World* World::duplicate   [inline]
 

Definition at line 82 of file world.hxx.

References World().

Referenced by Controller::push_undo(), and Controller::start_simulation().

Colliders& World::get_colliders   [inline]
 

Definition at line 103 of file world.hxx.

bool World::get_has_been_run   [inline]
 

Definition at line 108 of file world.hxx.

Referenced by Controller::has_been_run().

int World::get_num_particles  
 

Definition at line 655 of file world.cxx.

References ParticleFactory::size().

Referenced by WorldGUIManager::draw_overlay().

int World::get_num_springs  
 

Definition at line 661 of file world.cxx.

Referenced by WorldGUIManager::draw_overlay().

Particle * World::get_particle float    x,
float    y
 

Returns:
the particles closed to the given coordinates

Definition at line 433 of file world.cxx.

References ParticleFactory::begin(), ParticleFactory::end(), Vector2d::norm(), and ParticleFactory::ParticleIter.

Referenced by WorldViewInsertTool::draw_background(), WorldViewInsertTool::draw_foreground(), WorldViewInsertTool::on_delete_press(), WorldViewInsertTool::on_fix_press(), WorldViewSelectTool::on_primary_button_press(), and WorldViewInsertTool::on_primary_button_press().

ParticleFactory* World::get_particle_mgr   [inline]
 

Definition at line 101 of file world.hxx.

Referenced by RectCollider::bounce(), Selection::duplicate(), WorldViewInsertTool::on_primary_button_press(), Spring::Spring(), and zero_out_velocity().

std::vector< Particle * > World::get_particles float    x1,
float    y1,
float    x2,
float    y2
 

All particles inside the given rectangle

Definition at line 453 of file world.cxx.

References ParticleFactory::begin(), ParticleFactory::end(), Math::max(), Math::min(), and ParticleFactory::ParticleIter.

Referenced by Selection::select_particles().

Spring * World::get_spring float    x,
float    y
 

Definition at line 397 of file world.cxx.

References SpringIter.

Referenced by WorldViewInsertTool::draw_foreground(), and WorldViewInsertTool::on_delete_press().

std::vector<Spring*>& World::get_spring_mgr   [inline]
 

Definition at line 102 of file world.hxx.

Referenced by Selection::duplicate(), and WorldViewSelectTool::on_mouse_move().

void World::remove_collider Collider  
 

Definition at line 522 of file world.cxx.

Referenced by WorldViewColliderTool::on_secondary_button_release().

void World::remove_particle Particle  
 

removes the given particle and all objects which reference it

Definition at line 489 of file world.cxx.

References ParticleFactory::remove_particle(), and SpringIter.

Referenced by WorldViewSelectTool::on_delete_press(), and WorldViewInsertTool::on_delete_press().

void World::remove_spring Spring  
 

remove the given spring

Definition at line 511 of file world.cxx.

References ParticleFactory::size().

Referenced by WorldViewInsertTool::on_delete_press().

void World::update float    delta
 

Definition at line 319 of file world.cxx.

References ParticleFactory::add_particle(), ParticleFactory::begin(), ParticleFactory::end(), ParticleFactory::ParticleIter, SpringIter, and ParticleFactory::update().

Referenced by Controller::update().

void World::write_lisp const std::string &    filename
 

Definition at line 541 of file world.cxx.

References CSpringIter, SystemContext::get_user_email(), SystemContext::get_user_realname(), StringUtils::has_suffix(), lisp_dump(), lisp_free(), SystemContext::open_input_file(), SystemContext::open_output_file(), system_context, SystemContext::translate_filename(), and ParticleFactory::write_lisp().

Referenced by Controller::save_world().

void World::zero_out_velocity  
 

Sets the velocity of all particles to zero, usefull if the particles are getting out of order (aka. explode). Also usefull to fix broken model files

Definition at line 471 of file world.cxx.

References ParticleFactory::begin(), ParticleFactory::end(), get_particle_mgr(), and ParticleFactory::ParticleIter.


Friends And Related Function Documentation

friend class ParticleFactory [friend]
 

Definition at line 51 of file world.hxx.

Referenced by World().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 10:25:26 2003 for Construo by doxygen1.3-rc3