com.threerings.tudey.shape
Class Circle

java.lang.Object
  extended by com.threerings.tudey.shape.Shape
      extended by com.threerings.tudey.shape.Circle

public class Circle
extends Shape

A circle.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.tudey.shape.Shape
Shape.IntersectionType
 
Field Summary
 float radius
          The radius of the circle.
 
Constructor Summary
Circle()
          Creates an uninitialized circle.
Circle(Vector2f center, float radius)
          Creates a circle with the supplied center and radius.
 
Method Summary
 boolean contains(Vector2f pt)
          Checks whether the circle contains the specified point.
 ShapeConfig createConfig()
          Creates a config corresponding to this shape.
 void draw(boolean outline)
          Draws this shape in immediate mode.
 Shape expand(float amount, Shape result)
          Expands this shape, placing the result in the provided object if possible.
 Vector2f getCenter()
          Returns a reference to the center of the circle.
 Vector2f getCenter(Vector2f result)
          Retrieves the center of the shape and places it in the supplied vector.
 boolean getIntersection(Ray2D ray, Vector2f result)
          Finds the intersection of a ray with this shape and places it in the supplied vector (if it exists).
 Shape.IntersectionType getIntersectionType(Rect rect)
          Checks whether the intersector intersects the specified rect.
 void getNearestPoint(Vector2f point, Vector2f result)
          Fins the nearest point of this element to the supplied point and places it in the supplied vector.
 Vector2f getPenetration(Capsule capsule, Vector2f result)
          Finds the penetration of the specified capsule into this shape.
 Vector2f getPenetration(Circle circle, Vector2f result)
          Finds the penetration of the specified circle into this shape.
 Vector2f getPenetration(Compound compound, Vector2f result)
          Finds the penetration of the specified compound into this shape.
 Vector2f getPenetration(Point point, Vector2f result)
          Finds the penetration of the specified point into this shape.
 Vector2f getPenetration(Polygon polygon, Vector2f result)
          Finds the penetration of the specified polygon into this shape.
 Vector2f getPenetration(Segment segment, Vector2f result)
          Finds the penetration of the specified segment into this shape.
 Vector2f getPenetration(Shape shape, Vector2f result)
          Finds the penetration of the specified shape into this one, assuming that they intersect.
 boolean intersects(Capsule capsule)
          Checks for an intersection with this shape and the specified capsule.
 boolean intersects(Circle circle)
          Checks for an intersection with this shape and the specified circle.
 boolean intersects(Compound compound)
          Checks for an intersection with this shape and the specified compound.
 boolean intersects(Point point)
          Checks for an intersection with this shape and the specified point.
 boolean intersects(Polygon polygon)
          Checks for an intersection with this shape and the specified polygon.
 boolean intersects(Segment segment)
          Checks for an intersection with this shape and the specified segment.
 boolean intersects(Shape shape)
          Determines whether this shape intersects the specified shape.
 boolean intersects(SpaceElement element)
          Determines whether this shape intersects the specified element.
 Shape sweep(Vector2f translation, Shape result)
          Computes the shape created by sweeping this shape along the specified translation vector, placing the result in the provided object if possible.
 String toString()
           
 Shape transform(Transform2D transform, Shape result)
          Transforms this shape, placing the result in the provided object if possible.
 void updateBounds()
          Updates the bounds of the shape.
 
Methods inherited from class com.threerings.tudey.shape.Shape
expand, expandLocal, getBounds, getPenetration, getPerimeterPath, intersects, sweep, transform, transformLocal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radius

public float radius
The radius of the circle.

Constructor Detail

Circle

public Circle(Vector2f center,
              float radius)
Creates a circle with the supplied center and radius.


Circle

public Circle()
Creates an uninitialized circle.

Method Detail

getCenter

public Vector2f getCenter()
Returns a reference to the center of the circle.

Overrides:
getCenter in class Shape
Returns:
a new vector containing the result.

contains

public boolean contains(Vector2f pt)
Checks whether the circle contains the specified point.


updateBounds

public void updateBounds()
Description copied from class: Shape
Updates the bounds of the shape.

Specified by:
updateBounds in class Shape

getCenter

public Vector2f getCenter(Vector2f result)
Description copied from class: Shape
Retrieves the center of the shape and places it in the supplied vector.

Specified by:
getCenter in class Shape
Returns:
a reference to the result vector, for chaining.

transform

public Shape transform(Transform2D transform,
                       Shape result)
Description copied from class: Shape
Transforms this shape, placing the result in the provided object if possible.

Specified by:
transform in class Shape
Returns:
a reference to the result object, if it was reused; otherwise, a new object containing the result.

expand

public Shape expand(float amount,
                    Shape result)
Description copied from class: Shape
Expands this shape, placing the result in the provided object if possible.

Specified by:
expand in class Shape
Returns:
a reference to the result object, if it was reused; otherwise, a new object containing the result.

sweep

public Shape sweep(Vector2f translation,
                   Shape result)
Description copied from class: Shape
Computes the shape created by sweeping this shape along the specified translation vector, placing the result in the provided object if possible.

Specified by:
sweep in class Shape
Returns:
a reference to the result object, if it was reused; otherwise, a new object containing the result.

getIntersection

public boolean getIntersection(Ray2D ray,
                               Vector2f result)
Description copied from class: Shape
Finds the intersection of a ray with this shape and places it in the supplied vector (if it exists).

Specified by:
getIntersection in class Shape
Returns:
true if the ray intersected the shape (in which case the result will contain the point of intersection), false otherwise.

getNearestPoint

public void getNearestPoint(Vector2f point,
                            Vector2f result)
Description copied from class: Shape
Fins the nearest point of this element to the supplied point and places it in the supplied vector.

Specified by:
getNearestPoint in class Shape

getIntersectionType

public Shape.IntersectionType getIntersectionType(Rect rect)
Description copied from class: Shape
Checks whether the intersector intersects the specified rect.

Specified by:
getIntersectionType in class Shape

intersects

public boolean intersects(SpaceElement element)
Description copied from class: Shape
Determines whether this shape intersects the specified element. Uses double-dispatch to invoke the appropriate specialization of SpaceElement.intersects(com.threerings.tudey.shape.Point).

Specified by:
intersects in class Shape

intersects

public boolean intersects(Shape shape)
Description copied from class: Shape
Determines whether this shape intersects the specified shape. Uses double-dispatch to invoke the appropriate method specialization.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Point point)
Description copied from class: Shape
Checks for an intersection with this shape and the specified point.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Segment segment)
Description copied from class: Shape
Checks for an intersection with this shape and the specified segment.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Circle circle)
Description copied from class: Shape
Checks for an intersection with this shape and the specified circle.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Capsule capsule)
Description copied from class: Shape
Checks for an intersection with this shape and the specified capsule.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Polygon polygon)
Description copied from class: Shape
Checks for an intersection with this shape and the specified polygon.

Specified by:
intersects in class Shape

intersects

public boolean intersects(Compound compound)
Description copied from class: Shape
Checks for an intersection with this shape and the specified compound.

Specified by:
intersects in class Shape

getPenetration

public Vector2f getPenetration(Shape shape,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified shape into this one, assuming that they intersect. The penetration vector represents the minimum translation required to separate the two shapes. Uses double-dispatch to invoke the appropriate method specialization.

Specified by:
getPenetration in class Shape
Returns:
a reference to the result vector, for chaining.

getPenetration

public Vector2f getPenetration(Point point,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified point into this shape.

Specified by:
getPenetration in class Shape

getPenetration

public Vector2f getPenetration(Segment segment,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified segment into this shape.

Specified by:
getPenetration in class Shape

getPenetration

public Vector2f getPenetration(Circle circle,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified circle into this shape.

Specified by:
getPenetration in class Shape

getPenetration

public Vector2f getPenetration(Capsule capsule,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified capsule into this shape.

Specified by:
getPenetration in class Shape

getPenetration

public Vector2f getPenetration(Polygon polygon,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified polygon into this shape.

Specified by:
getPenetration in class Shape

getPenetration

public Vector2f getPenetration(Compound compound,
                               Vector2f result)
Description copied from class: Shape
Finds the penetration of the specified compound into this shape.

Specified by:
getPenetration in class Shape

draw

public void draw(boolean outline)
Description copied from class: Shape
Draws this shape in immediate mode.

Specified by:
draw in class Shape
Parameters:
outline - if true, draw the outline of the shape; otherwise, the solid form.

createConfig

public ShapeConfig createConfig()
Description copied from class: Shape
Creates a config corresponding to this shape.

Specified by:
createConfig in class Shape

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.