Package com.attivio.sdk.geo
Class Circle
- java.lang.Object
-
- com.attivio.sdk.geo.Shape
-
- com.attivio.sdk.geo.AbstractEllipse
-
- com.attivio.sdk.geo.Circle
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Shape>
public final class Circle extends AbstractEllipse
Defines a circle.WARNING: this API is experimental and will likely change in the near future.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.attivio.sdk.geo.AbstractEllipse
centerX, centerY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArguments(java.lang.StringBuilder buffer)
Circle
clone()
boolean
contains(double x, double y)
Return true if this shape contains the point defined by (x
,y
).double
distance(double x, double y)
Calculate the distance between (x, y) and this circle's center.boolean
equals(java.lang.Object other)
boolean
fastIntersects(Rectangle other)
Check if this shape's bounding box intersects withbox
.Rectangle
getBoundingBox()
Get the rectangle that represents the bounding box that fully contains this shape.double
getMaxRadius()
Get the minimum radius for this ellipse.double
getMinRadius()
Get the maximum radius for this ellipse.Point
getPoint(double angle)
Get a point on this ellipse atangle
.double
getPointX(double angle)
Get the X coordinate for a point on this ellipse atangle
.double
getPointY(double angle)
Get the Y coordinate for a point on this ellipse atangle
.double
getRadius()
Get the radius for this circle.protected double
getRadiusA()
Get the first radius for the ellipse.protected double
getRadiusB()
Get the second for the ellipse.protected double
getRotationCos()
Get the cosine of the rotation angle.protected double
getRotationSin()
Get the sine of the rotation angle.java.lang.String
getTypeName()
int
hashCode()
boolean
intersects(Circle other)
Check ifother
and this
Circle
intersect.boolean
intersects(Rectangle other)
Check ifother
and this
Circle
intersect.boolean
intersects(Rectangle box, AbstractEllipse ellipse)
Check for intersection withother
.boolean
intersects(Rectangle box, Shape shape)
Check if this shape intersects withother
.Circle
readExternal(java.io.DataInput in)
void
setRadius(double value)
void
writeExternal(java.io.DataOutput out)
-
Methods inherited from class com.attivio.sdk.geo.AbstractEllipse
getA, getB, getC, getCenter, getCenterX, getCenterY, getHeight, getRotationAngle, getWidth, intersects, setCenter, setCenterX, setCenterY
-
Methods inherited from class com.attivio.sdk.geo.Shape
compareTo, contains, intersects, readExternal, toString, toString, toString, valueOf, writeExternal
-
-
-
-
Constructor Detail
-
Circle
public Circle()
-
Circle
public Circle(double centerX, double centerY, double radius)
-
Circle
public Circle(Point center, double radius)
-
-
Method Detail
-
getTypeName
public java.lang.String getTypeName()
- Specified by:
getTypeName
in classShape
-
getRadius
public double getRadius()
Get the radius for this circle.
-
setRadius
public void setRadius(double value)
-
getRadiusA
protected double getRadiusA()
Get the first radius for the ellipse.This is the radius along the X plane.
- Specified by:
getRadiusA
in classAbstractEllipse
-
getRadiusB
protected double getRadiusB()
Get the second for the ellipse.This is the radius along the Y plane.
- Specified by:
getRadiusB
in classAbstractEllipse
-
getMaxRadius
public double getMaxRadius()
Get the minimum radius for this ellipse.- Overrides:
getMaxRadius
in classAbstractEllipse
-
getMinRadius
public double getMinRadius()
Get the maximum radius for this ellipse.- Overrides:
getMinRadius
in classAbstractEllipse
-
getPoint
public Point getPoint(double angle)
Get a point on this ellipse atangle
.- Overrides:
getPoint
in classAbstractEllipse
-
getPointX
public double getPointX(double angle)
Get the X coordinate for a point on this ellipse atangle
.- Overrides:
getPointX
in classAbstractEllipse
-
getPointY
public double getPointY(double angle)
Get the Y coordinate for a point on this ellipse atangle
.- Overrides:
getPointY
in classAbstractEllipse
-
getRotationCos
protected double getRotationCos()
Get the cosine of the rotation angle.- Overrides:
getRotationCos
in classAbstractEllipse
-
getRotationSin
protected double getRotationSin()
Get the sine of the rotation angle.- Overrides:
getRotationSin
in classAbstractEllipse
-
contains
public boolean contains(double x, double y)
Return true if this shape contains the point defined by (x
,y
).
-
intersects
public boolean intersects(Rectangle box, Shape shape)
Check if this shape intersects withother
.- Overrides:
intersects
in classAbstractEllipse
- Parameters:
box
- The bounding box of this shape fromShape.getBoundingBox()
.shape
- The shape to check for intersection with
-
distance
public double distance(double x, double y)
Calculate the distance between (x, y) and this circle's center.
-
intersects
public boolean intersects(Rectangle box, AbstractEllipse ellipse)
Check for intersection withother
.- Specified by:
intersects
in classAbstractEllipse
-
fastIntersects
public boolean fastIntersects(Rectangle other)
Check if this shape's bounding box intersects withbox
.- Specified by:
fastIntersects
in classShape
-
getBoundingBox
public Rectangle getBoundingBox()
Get the rectangle that represents the bounding box that fully contains this shape.- Specified by:
getBoundingBox
in classShape
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
addArguments
public void addArguments(java.lang.StringBuilder buffer)
- Specified by:
addArguments
in classShape
-
writeExternal
public void writeExternal(java.io.DataOutput out) throws java.io.IOException
- Specified by:
writeExternal
in classShape
- Throws:
java.io.IOException
-
readExternal
public Circle readExternal(java.io.DataInput in) throws java.io.IOException
- Specified by:
readExternal
in classShape
- Throws:
java.io.IOException
-
-