kcl.waterloo.marker
Class ShapeUtils
- java.lang.Object
-
- kcl.waterloo.marker.ShapeUtils
-
public class ShapeUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static booleancontains(java.awt.Shape s1, java.awt.Shape s2)Tests whether shape s2 lays within shape s1.static doublegetArea(java.awt.Shape s)Returns a numerical estimate of the area of a shape.static java.awt.geom.Point2D.DoublegetCentroid(java.awt.Shape s)Returns a numerical estimate of the centroid (center of mass) of the specified Shape.static double[]getFlattenedX(java.awt.Shape s)static double[]getFlattenedX(java.awt.Shape s, double flatness)static GJXYSeriesgetFlattenedXY(java.awt.Shape s)static GJXYSeriesgetFlattenedXY(java.awt.Shape s, double flatness)static double[]getFlattenedY(java.awt.Shape s)static double[]getFlattenedY(java.awt.Shape s, double flatness)static java.awt.geom.Path2DgetFromX(GJGraphInterface gr, java.awt.Shape p, double y)static java.awt.geom.Path2DgetFromY(GJGraphInterface gr, java.awt.Shape p, double x)static java.awt.geom.Path2DgetFromZeroX(GJGraphInterface gr, java.awt.Shape p)static java.awt.geom.Path2DgetFromZeroY(GJGraphInterface gr, java.awt.Shape p, double x)static java.util.ArrayList<GJPathSegmentInfo>getSegments(java.awt.Shape p)static double[]getStringLocationToArc(double[] xy, double theta, java.lang.String s, java.awt.FontMetrics metrics)static double[]getX(java.awt.Shape s)static GJXYSeriesgetXY(java.awt.Shape s)static double[]getXYOnArc(java.awt.geom.Ellipse2D arc0, java.awt.geom.Ellipse2D arc1, double theta)Given an arc, arc0 and an angle theta, getXYOnArc returns the XY coordinates for the intersection of theta on the second arc, arc1.static double[]getY(java.awt.Shape s)static booleanintersects(java.awt.Shape s1, java.awt.Shape s2)Tests whether shape s2 lays within shape s1.static booleanisClosed(java.awt.Shape s)static doublesumdX(java.awt.Shape s)static java.lang.StringtoString(java.awt.Shape s)
-
-
-
Method Detail
-
getSegments
public static java.util.ArrayList<GJPathSegmentInfo> getSegments(java.awt.Shape p)
-
getXY
public static GJXYSeries getXY(java.awt.Shape s)
-
getX
public static double[] getX(java.awt.Shape s)
-
getFlattenedXY
public static GJXYSeries getFlattenedXY(java.awt.Shape s)
-
getFlattenedXY
public static GJXYSeries getFlattenedXY(java.awt.Shape s, double flatness)
-
getFlattenedX
public static double[] getFlattenedX(java.awt.Shape s)
-
getFlattenedX
public static double[] getFlattenedX(java.awt.Shape s, double flatness)
-
getY
public static double[] getY(java.awt.Shape s)
-
getFlattenedY
public static double[] getFlattenedY(java.awt.Shape s)
-
getFlattenedY
public static double[] getFlattenedY(java.awt.Shape s, double flatness)
-
getFromZeroX
public static java.awt.geom.Path2D getFromZeroX(GJGraphInterface gr, java.awt.Shape p)
-
getFromX
public static java.awt.geom.Path2D getFromX(GJGraphInterface gr, java.awt.Shape p, double y)
-
getFromZeroY
public static java.awt.geom.Path2D getFromZeroY(GJGraphInterface gr, java.awt.Shape p, double x)
-
getFromY
public static java.awt.geom.Path2D getFromY(GJGraphInterface gr, java.awt.Shape p, double x)
-
getArea
public static double getArea(java.awt.Shape s)
Returns a numerical estimate of the area of a shape.- Parameters:
s- a Shape- Returns:
- the area.
-
getCentroid
public static java.awt.geom.Point2D.Double getCentroid(java.awt.Shape s)
Returns a numerical estimate of the centroid (center of mass) of the specified Shape.- Parameters:
s- a Shape object- Returns:
- the estimate as a Point2d.Double instance.
-
contains
public static boolean contains(java.awt.Shape s1, java.awt.Shape s2)Tests whether shape s2 lays within shape s1.- Parameters:
s1- a Shapes2- a Shape- Returns:
- true if s2 lies within s1.
-
intersects
public static boolean intersects(java.awt.Shape s1, java.awt.Shape s2)Tests whether shape s2 lays within shape s1.- Parameters:
s1- a Shapes2- a Shape- Returns:
- true if s2 lies within s1.
-
sumdX
public static double sumdX(java.awt.Shape s)
-
isClosed
public static boolean isClosed(java.awt.Shape s)
-
toString
public static java.lang.String toString(java.awt.Shape s)
-
getXYOnArc
public static double[] getXYOnArc(java.awt.geom.Ellipse2D arc0, java.awt.geom.Ellipse2D arc1, double theta)Given an arc, arc0 and an angle theta, getXYOnArc returns the XY coordinates for the intersection of theta on the second arc, arc1.- Parameters:
arc0-arc1-theta-- Returns:
-
getStringLocationToArc
public static double[] getStringLocationToArc(double[] xy, double theta, java.lang.String s, java.awt.FontMetrics metrics)
-
-
DMelt 3.0 © DataMelt by jWork.ORG