Package org.graphstream.ui.swing.util
Class ShapeUtil
java.lang.Object
org.graphstream.ui.swing.util.ShapeUtil
public class ShapeUtil
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description ShapeUtil()
-
Method Summary
Modifier and Type Method Description static double
evalBoxRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h)
Compute the length of a vector along the edge from the box center that match the box "radius".static double
evalEllipseRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h)
Compute the length of a vector along the edge from the ellipse center that match the ellipse radius.static double
evalEllipseRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h, double s)
Compute the length of a (eventually cubic curve) vector along the edge from the ellipse center toward the intersection point with the ellipse that match the ellipse radius.static double
evalTargetRadius2D(org.graphstream.ui.geom.Point3 from, org.graphstream.ui.geom.Point3 to, org.graphstream.ui.graphicGraph.GraphicNode node, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Try to evaluate the "radius" of the given node considering an edge between points `from` and `to`.static double
evalTargetRadius2D(org.graphstream.ui.graphicGraph.GraphicEdge edge, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Try to evaluate the "radius" of the given area skeleton considering a cubic curve edge between points `p0` and point `p3` and curving to control points `p1` and `p2`.static double
evalTargetRadius2D(org.graphstream.ui.graphicGraph.GraphicEdge edge, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Try to evaluate the "radius" of the edge target node shape along the edge.static double
evalTargetRadius2D(org.graphstream.ui.graphicGraph.stylesheet.Style style, AreaSkeleton skeleton, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Try to evaluate the "radius" of the given area skeleton considering a cubic curve edge between points `p0` and point `p3` and curving to control points `p1` and `p2`.static double
evalTargetRadius2D(org.graphstream.ui.graphicGraph.stylesheet.Style style, AreaSkeleton skeleton, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Try to evaluate the "radius" of the given area skeleton considering an edge between points `p0` and point `p3` (the edge is considered a straight line).static boolean
isPointIn(org.graphstream.ui.graphicGraph.GraphicElement elt, org.graphstream.ui.geom.Point3 p, double w, double h)
Compute if point `p` is inside of the shape of `elt` whose overall size is `w` x `h`.static boolean
isPointIn2DBox(org.graphstream.ui.geom.Point3 p, double x, double y, double w, double h)
Compute if point `p` is inside of a rectangular shape of overall size `w` x `h`.static boolean
isPointIn2DEllipse(org.graphstream.ui.geom.Point3 p, double x, double y, double w, double h)
Compute if point `p` is inside of a ellipsoid shape of overall size `w` x `h`.
-
Constructor Details
-
ShapeUtil
public ShapeUtil()
-
-
Method Details
-
evalTargetRadius2D
public static double evalTargetRadius2D(org.graphstream.ui.graphicGraph.GraphicEdge edge, org.graphstream.ui.view.camera.DefaultCamera2D camera)Try to evaluate the "radius" of the edge target node shape along the edge. In other words this method computes the intersection point between the edge and the node shape contour. The returned length is the length of a line going from the center of the shape toward the point of intersection between the target node shape contour and the edge.- Parameters:
edge
- The edge (it contains its target node).camera
- the camera.- Returns:
- The radius.
-
evalTargetRadius2D
public static double evalTargetRadius2D(org.graphstream.ui.geom.Point3 from, org.graphstream.ui.geom.Point3 to, org.graphstream.ui.graphicGraph.GraphicNode node, org.graphstream.ui.view.camera.DefaultCamera2D camera)Try to evaluate the "radius" of the given node considering an edge between points `from` and `to`. In other words, this method computes the intersection point between the edge and the node shape contour. The returned length is the length of a line going from the center of the shape toward the point of intersection between the target node shape contour and the edge.- Parameters:
from
- The origin point of the edge.to
- The target point of the edge.node
- The target node shape.the
- camera.- Returns:
- The radius.
-
evalTargetRadius2D
public static double evalTargetRadius2D(org.graphstream.ui.graphicGraph.stylesheet.Style style, AreaSkeleton skeleton, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)Try to evaluate the "radius" of the given area skeleton considering an edge between points `p0` and point `p3` (the edge is considered a straight line). In other words, this method computes the intersection point between the edge and the area geometry. The returned length of the line going from the center of the skeleton geometry toward the point of intersection between the skeleton geometry and the edge.- Parameters:
style
- The style of the area skeleton.skeleton
- The skeleton.p0
- The origin point of the edge.p3
- the target point of the edge.camera
- the camera.- Returns:
- the radius.
-
evalTargetRadius2D
public static double evalTargetRadius2D(org.graphstream.ui.graphicGraph.GraphicEdge edge, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)Try to evaluate the "radius" of the given area skeleton considering a cubic curve edge between points `p0` and point `p3` and curving to control points `p1` and `p2`. In other words, this method computes the intersection point between the edge and the area geometry. The returned length of the line going from the center of the skeleton geometry toward the point of intersection between the skeleton geometry and the edge.- Parameters:
edge
- The edge.p0
- The origin point of the edge.p3
- the target point of the edge.camera
- the camera.- Returns:
- the radius.
-
evalTargetRadius2D
public static double evalTargetRadius2D(org.graphstream.ui.graphicGraph.stylesheet.Style style, AreaSkeleton skeleton, org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, org.graphstream.ui.view.camera.DefaultCamera2D camera)Try to evaluate the "radius" of the given area skeleton considering a cubic curve edge between points `p0` and point `p3` and curving to control points `p1` and `p2`. In other words, this method computes the intersection point between the edge and the area geometry. The returned length of the line going from the center of the skeleton geometry toward the point of intersection between the skeleton geometry and the edge.- Parameters:
style
- The style of the area skeleton.skeleton
- The skeleton.p0
- The origin point of the edge.p3
- the target point of the edge.camera
- the camera.- Returns:
- the radius.
-
evalEllipseRadius2D
public static double evalEllipseRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h, double s)Compute the length of a (eventually cubic curve) vector along the edge from the ellipse center toward the intersection point with the ellipse that match the ellipse radius. If `p1` and `p2` are null, the edge is considered a straight line, else a cubic curve.- Parameters:
p0
- the origin point of the edgep1
- the first cubic-curve control point or null for straight edge.p2
- the second cubic-curve control point or null for straight edge.p3
- the target point of the edge.w
- the width of the ellipse.h
- the height of the ellipse.s
- the width of the stroke of the ellipse shape.
-
evalEllipseRadius2D
public static double evalEllipseRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h)Compute the length of a vector along the edge from the ellipse center that match the ellipse radius.- Parameters:
edge
- The edge representing the vector.w
- The ellipse first radius (width/2).h
- The ellipse second radius (height/2).- Returns:
- The length of the radius along the edge vector.
-
evalBoxRadius2D
public static double evalBoxRadius2D(org.graphstream.ui.geom.Point3 p0, org.graphstream.ui.geom.Point3 p1, org.graphstream.ui.geom.Point3 p2, org.graphstream.ui.geom.Point3 p3, double w, double h)Compute the length of a vector along the edge from the box center that match the box "radius".- Parameters:
edge
- The edge representing the vector.w
- The box first radius (width/2).h
- The box second radius (height/2).- Returns:
- The length of the radius along the edge vector.
-
isPointIn
public static boolean isPointIn(org.graphstream.ui.graphicGraph.GraphicElement elt, org.graphstream.ui.geom.Point3 p, double w, double h)Compute if point `p` is inside of the shape of `elt` whose overall size is `w` x `h`. -
isPointIn2DBox
public static boolean isPointIn2DBox(org.graphstream.ui.geom.Point3 p, double x, double y, double w, double h)Compute if point `p` is inside of a rectangular shape of overall size `w` x `h`. -
isPointIn2DEllipse
public static boolean isPointIn2DEllipse(org.graphstream.ui.geom.Point3 p, double x, double y, double w, double h)Compute if point `p` is inside of a ellipsoid shape of overall size `w` x `h`.
-