devisor2.foundation.boundary
Class SegmentCircle

java.lang.Object
  extended bydevisor2.foundation.GridItem
      extended bydevisor2.foundation.boundary.Segment
          extended bydevisor2.foundation.boundary.SegmentCircle
All Implemented Interfaces:
java.io.Serializable

public class SegmentCircle
extends Segment
implements java.io.Serializable

This class represents the Segment type CIRCLE. As always, coordinates are all given in world space (the big ints). A circle is completely defined by the midpoints, its radius, and a start- and end angle of the arc. These angles are all measured in degrees against the three o'clock position.

See Also:
Segment, Serialized Form

Field Summary
 
Fields inherited from class devisor2.foundation.boundary.Segment
boundary, orientation_marker_1, orientation_marker_2, orientation_marker_3, tmax
 
Fields inherited from class devisor2.foundation.GridItem
cc, marked, transformed, xmax, xmin, ymax, ymin
 
Constructor Summary
SegmentCircle()
          creates an empty SegmentCircle
SegmentCircle(int tx, int ty, int tr, double tsa, double tsb)
          creates the segment type circle
 
Method Summary
 void adjustPerimeter(Node n, int index)
          change coordinates therefor, that at indes 0 that the beginning of this segment is at node 'n', else that the ending of this segment is at node 'n'.
 java.lang.Object clone()
          creates a full clone of the SegmentCircle object, including boundary information
 void draw(java.awt.Graphics g)
          draws the segment
 Node getCartesianCoords(double t)
          gets the cartesian coordinates of the node according to parameter t
 double getEndAngle()
          returns the end angle (in degrees)
 int[] getMidPoint()
          returns the midpoint of the circle (WORLD COORDS)
 double[] getParameters()
          gets the parameters of the circle
 double getParameterValue(Node n)
          calculate parameter value of node 'n' from its x/y coordinates (note: only the relative parameter value is calculated, the boundary-wide value is not considered)
 int[] getParams()
          gets the parameters of the circle
 java.awt.Rectangle getPerimeter()
          returns the perimeter of the Circle element, that is the smallest bounding box completely containing the Circle
 int getRadius()
          returns the radius of the circle (WORLD COORDS)
 double getStartAngle()
          returns the start angle (in degrees)
 boolean isHit(int xx, int yy)
          Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES to avoid the snap mechanism
 boolean isInside(int[] topleft, int[] bottomright)
          Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
 boolean isOnBoundary(int tx, int ty)
          returns whether or not a point lies on a boundary segment
 void performMirror(double nx, double ny, double px, double py)
          This method mirrors the circle at the given line
 void performTransformation(GridTransformation trafo)
          applies the given affine transformation to the circle
 void setEndAngle(double angle)
          sets the end angle (in degrees)
 void setMidPoint(int xx, int yy)
          sets the midpoint to the given parameters (WORLD COORDS)
 void setParameters(double[] ux)
          sets the parameters of the Circle
 void setParams(int[] ux)
          sets the parameters of the Circle
 void setRadius(int newr)
          sets the radius to the given value (WORLD COORDS)
 void setStartAngle(double angle)
          sets the start angle (in degrees)
 void swapPerimeter()
          inverts orientation of this segment without changing parameter values of related boundarynodes.
 void updateInnerData()
          updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the circle object
 
Methods inherited from class devisor2.foundation.boundary.Segment
drawOrientationMarker, getBoundary, getBoundaryNumber, getSegmentNumber, getTMax, setBoundary, setTMax
 
Methods inherited from class devisor2.foundation.GridItem
clearTransformedFlag, isMarked, setMarker, setMarker, unsetMarker
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentCircle

public SegmentCircle(int tx,
                     int ty,
                     int tr,
                     double tsa,
                     double tsb)
creates the segment type circle

Parameters:
tr - radius

SegmentCircle

public SegmentCircle()
creates an empty SegmentCircle

Method Detail

setParameters

public void setParameters(double[] ux)
sets the parameters of the Circle

Specified by:
setParameters in class Segment

getParameters

public double[] getParameters()
gets the parameters of the circle

Specified by:
getParameters in class Segment

setParams

public void setParams(int[] ux)
sets the parameters of the Circle

Specified by:
setParams in class Segment

getParams

public int[] getParams()
gets the parameters of the circle

Specified by:
getParams in class Segment

getRadius

public int getRadius()
returns the radius of the circle (WORLD COORDS)


setRadius

public void setRadius(int newr)
sets the radius to the given value (WORLD COORDS)


getMidPoint

public int[] getMidPoint()
returns the midpoint of the circle (WORLD COORDS)


setMidPoint

public void setMidPoint(int xx,
                        int yy)
sets the midpoint to the given parameters (WORLD COORDS)


getStartAngle

public double getStartAngle()
returns the start angle (in degrees)


setStartAngle

public void setStartAngle(double angle)
sets the start angle (in degrees)


getEndAngle

public double getEndAngle()
returns the end angle (in degrees)


setEndAngle

public void setEndAngle(double angle)
sets the end angle (in degrees)


swapPerimeter

public void swapPerimeter()
Description copied from class: Segment
inverts orientation of this segment without changing parameter values of related boundarynodes.

Specified by:
swapPerimeter in class Segment
See Also:
Segment.swapPerimeter

adjustPerimeter

public void adjustPerimeter(Node n,
                            int index)
Description copied from class: Segment
change coordinates therefor, that at indes 0 that the beginning of this segment is at node 'n', else that the ending of this segment is at node 'n'.

Specified by:
adjustPerimeter in class Segment
See Also:
Segment.adjustPerimeter

getCartesianCoords

public Node getCartesianCoords(double t)
Description copied from class: Segment
gets the cartesian coordinates of the node according to parameter t

Specified by:
getCartesianCoords in class Segment
Parameters:
t - parameter value
Returns:
Node representation of the coordinates
See Also:
Segment.getCartesianCoords

isOnBoundary

public boolean isOnBoundary(int tx,
                            int ty)
Description copied from class: Segment
returns whether or not a point lies on a boundary segment

Specified by:
isOnBoundary in class Segment
Returns:
true if the Point is on the segment, false otherwise
See Also:
Segment.isOnBoundary

getParameterValue

public double getParameterValue(Node n)
Description copied from class: Segment
calculate parameter value of node 'n' from its x/y coordinates (note: only the relative parameter value is calculated, the boundary-wide value is not considered)

Specified by:
getParameterValue in class Segment
See Also:
Segment.getParameterValue

draw

public void draw(java.awt.Graphics g)
draws the segment

Specified by:
draw in class Segment
Parameters:
g - - the graphics context to paint to

isInside

public boolean isInside(int[] topleft,
                        int[] bottomright)
Is the item inside a given rectangular area? All in WORLD COORDINATES!!!

Specified by:
isInside in class Segment
Parameters:
topleft - - the topleft corner of the rectangle
bottomright - - the bottom right corner of the rectangle
Returns:
true if the item is completely inside the rectangle

isHit

public boolean isHit(int xx,
                     int yy)
Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES to avoid the snap mechanism

Specified by:
isHit in class Segment
Returns:
true if the item has been hit

updateInnerData

public void updateInnerData()
updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the circle object

Specified by:
updateInnerData in class Segment

getPerimeter

public java.awt.Rectangle getPerimeter()
returns the perimeter of the Circle element, that is the smallest bounding box completely containing the Circle

Specified by:
getPerimeter in class Segment

performTransformation

public void performTransformation(GridTransformation trafo)
applies the given affine transformation to the circle

Specified by:
performTransformation in class Segment

performMirror

public void performMirror(double nx,
                          double ny,
                          double px,
                          double py)
This method mirrors the circle at the given line

Specified by:
performMirror in class Segment

clone

public java.lang.Object clone()
creates a full clone of the SegmentCircle object, including boundary information

Specified by:
clone in class Segment