Module org.jfree.chart3d
Package org.jfree.chart3d.graphics3d

# Class World

java.lang.Object
org.jfree.chart3d.graphics3d.World

public class World extends Object
A world is a model containing a collection of objects in 3D space and a direction vector for the sunlight. A viewing point (`ViewPoint3D`) is specified externally. Objects in the world are assigned to a partition, providing the ability to group objects.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DEFAULT_PARTITION_KEY`
The default partition key.

## Constructor Summary

Constructors
Constructor
Description
`World()`
Creates a new empty world.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(String partition, Object3D object)`
Adds an object to a specific partition.
`void`
`add(Object3D object)`
Adds an object to the world in the default partition.
`void`
`addAll(Collection<Object3D> objects)`
Adds a collection of objects to the world (in the default partition).
`Point3D[]`
`calculateEyeCoordinates(ViewPoint3D vp)`
Returns an array containing the vertices for all objects in this world, transformed to eye coordinates.
`Point2D[]`
`calculateProjectedPoints(ViewPoint3D vp, double d)`
Calculates the projected points in 2D-space for all the vertices of the objects in the world.
`void`
`clear(String partitionKey)`
Clears any objects belonging to the specified partition.
`List<Face>`
`getFaces()`
Fetches the faces for all the objects in this world, updating the offset to match the current position.
`List<Object3D>`
`getObjects()`
Returns a newly created list containing all the objects in the world model.
`double`
`getSunX()`
Returns the x-component of the sunlight vector.
`double`
`getSunY()`
Returns the y-component of the sunlight vector.
`double`
`getSunZ()`
Returns the z-component of the sunlight vector.
`int`
`getVertexCount()`
Returns the total number of vertices for all objects in this world.
`final void`
`setSunSource(double x, double y, double z)`
Sets the light source point.
`final void`
`setSunSource(Point3D p)`
Sets the light source point.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_PARTITION_KEY

public static final String DEFAULT_PARTITION_KEY
The default partition key. All objects in the world are added with a partition key. There always exists at least one partition (the default partition).

Since:
  1.2
See Also:
  - Constant Field Values

## Constructor Details

### World

public World()
Creates a new empty world.

## Method Details

### getSunX

public double getSunX()
Returns the x-component of the sunlight vector.

Returns:
  The x-component of the sunlight vector.

### getSunY

public double getSunY()
Returns the y-component of the sunlight vector.

Returns:
  The y-component of the sunlight vector.

### getSunZ

public double getSunZ()
Returns the z-component of the sunlight vector.

Returns:
  The z-component of the sunlight vector.

### setSunSource

public final void setSunSource(double x, double y, double z)
Sets the light source point.

Parameters:
  `x` - the x-coordinate.
  `y` - the y-coordinate.
  `z` - the z-coordinate.
Since:
  1.2

### setSunSource

public final void setSunSource(Point3D p)
Sets the light source point.

Parameters:
  `p` - the point (`null` not permitted).
Since:
  1.2

### add

public void add(Object3D object)
Adds an object to the world in the default partition.

Parameters:
  `object` - the object (`null` not permitted).

### add

public void add(String partition, Object3D object)
Adds an object to a specific partition.

Parameters:
  `partition` - the partition (`null` not permitted).
  `object` - the object (`null` not permitted).
Since:
  1.2

### addAll

public void addAll(Collection<Object3D> objects)
Adds a collection of objects to the world (in the default partition).

Parameters:
  `objects` - the objects (`null` not permitted).

### clear

public void clear(String partitionKey)
Clears any objects belonging to the specified partition.

Parameters:
  `partitionKey` - the partition key (`null` not permitted).
Since:
  1.2

### getVertexCount

public int getVertexCount()
Returns the total number of vertices for all objects in this world.

Returns:
  The total number of vertices.

### calculateEyeCoordinates

public Point3D[] calculateEyeCoordinates(ViewPoint3D vp)
Returns an array containing the vertices for all objects in this world, transformed to eye coordinates.

Parameters:
  `vp` - the view point (`null` not permitted).
Returns:
  The eye coordinates.

### calculateProjectedPoints

public Point2D[] calculateProjectedPoints(ViewPoint3D vp, double d)
Calculates the projected points in 2D-space for all the vertices of the objects in the world.

Parameters:
  `vp` - the view point (`null` not permitted).
  `d` - the distance.
Returns:
  The projected points.

### getFaces

public List<Face> getFaces()
Fetches the faces for all the objects in this world, updating the offset to match the current position.

Returns:
  A list of faces.

### getObjects

public List<Object3D> getObjects()
Returns a newly created list containing all the objects in the world model.

Returns:
  The list of objects.
Since:
  1.2