Class BayazitDecomposer

java.lang.Object
net.dermetfan.gdx.math.BayazitDecomposer

public abstract class BayazitDecomposer
extends java.lang.Object
Taken from Aurelien Ribon's Physics Body Editor

Convex decomposition algorithm created by Mark Bayazit more information about this algorithm
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  BayazitDecomposer.SimplifyTools  
  • Field Summary

    Fields
    Modifier and Type Field Description
    static float EPSILON  
    static int maxPolygonVertices  
  • Constructor Summary

    Constructors
    Constructor Description
    BayazitDecomposer()  
  • Method Summary

    Modifier and Type Method Description
    static float area​(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.math.Vector2 c)  
    static com.badlogic.gdx.utils.Array<com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>> convexPartition​(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)
    Decompose the polygon into several smaller non-concave polygon.
    static com.badlogic.gdx.math.Vector2 cross​(com.badlogic.gdx.math.Vector2 a, float s)  
    static boolean floatEquals​(float value1, float value2)  
    static com.badlogic.gdx.math.Vector2 lineIntersect​(com.badlogic.gdx.math.Vector2 p1, com.badlogic.gdx.math.Vector2 p2, com.badlogic.gdx.math.Vector2 q1, com.badlogic.gdx.math.Vector2 q2)  
    static boolean lineIntersect​(com.badlogic.gdx.math.Vector2 point1, com.badlogic.gdx.math.Vector2 point2, com.badlogic.gdx.math.Vector2 point3, com.badlogic.gdx.math.Vector2 point4, boolean firstIsSegment, boolean secondIsSegment, com.badlogic.gdx.math.Vector2 point)
    This method detects if two line segments (or lines) intersect, and, if so, the point of intersection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EPSILON

      public static final float EPSILON
      See Also:
      Constant Field Values
    • maxPolygonVertices

      public static int maxPolygonVertices
  • Constructor Details

    • BayazitDecomposer

      public BayazitDecomposer()
  • Method Details

    • cross

      public static com.badlogic.gdx.math.Vector2 cross​(com.badlogic.gdx.math.Vector2 a, float s)
    • convexPartition

      public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>> convexPartition​(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)
      Decompose the polygon into several smaller non-concave polygon. If the polygon is already convex, it will return the original polygon, unless it is over Settings.MaxPolygonVertices. Precondition: Counter Clockwise polygon
    • lineIntersect

      public static com.badlogic.gdx.math.Vector2 lineIntersect​(com.badlogic.gdx.math.Vector2 p1, com.badlogic.gdx.math.Vector2 p2, com.badlogic.gdx.math.Vector2 q1, com.badlogic.gdx.math.Vector2 q2)
    • floatEquals

      public static boolean floatEquals​(float value1, float value2)
    • lineIntersect

      public static boolean lineIntersect​(com.badlogic.gdx.math.Vector2 point1, com.badlogic.gdx.math.Vector2 point2, com.badlogic.gdx.math.Vector2 point3, com.badlogic.gdx.math.Vector2 point4, boolean firstIsSegment, boolean secondIsSegment, com.badlogic.gdx.math.Vector2 point)
      This method detects if two line segments (or lines) intersect, and, if so, the point of intersection. Use the firstIsSegment and secondIsSegment parameters to set whether the intersection point must be on the first and second line segments. Setting these both to true means you are doing a line-segment to line-segment intersection. Setting one of them to true means you are doing a line to line-segment intersection test, and so on. Note: If two line segments are coincident, then no intersection is detected (there are actually infinite intersection points).
      Parameters:
      point1 - The first point of the first line segment.
      point2 - The second point of the first line segment.
      point3 - The first point of the second line segment.
      point4 - The second point of the second line segment.
      firstIsSegment - Set this to true to require that the intersection point be on the first line segment.
      secondIsSegment - Set this to true to require that the intersection point be on the second line segment.
      point - This is set to the intersection point if an intersection is detected.
      Returns:
      True if an intersection is detected, false otherwise. Author: Jeremy Bell
    • area

      public static float area​(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.math.Vector2 c)