Class SelectionQuery

All Implemented Interfaces:
Shape, Serializable, Cloneable

public class SelectionQuery extends Rectangle
A SelectionQuery represents a selection made by the user. It is represented as a rectangle defined by two ScreenPoints (the corners). It can be used to check whether certain GObjects are within the selection.
Author:
Lehlogonolo Poole
See Also:
  • Field Details

  • Constructor Details

    • SelectionQuery

      public SelectionQuery(ScreenPoint i, ScreenPoint ii, SelectionType t)
      Constructs a SelectionQuery object with the given screen points and selection type.
      Parameters:
      i - The first screen point.
      ii - The second screen point.
      t - The type of selection.
  • Method Details

    • has

      public boolean has(GObject obj, boolean soft)
      Whether the Selection has the given GObject.
      Parameters:
      obj - The GObject to check.
      soft - If false, we strictly check whether the GObject is fully contained within the selection. Otherwise, we check whether the selection does so much as intersect with the GObject.
    • has

      public boolean has(GCurve curve, boolean soft)
    • has

      public boolean has(Triangle triangle, boolean soft)
      Whether the Selection has the triangle.
      Parameters:
      triangle - The triangle to check.
      soft - If false, we strictly check whether the triangle is fully contained within the selection. Otherwise, we check whether the selection does so much as intersect with ay of the lines of the triangle.
      Returns:
      true if all the points are within the triangle
    • has

      public boolean has(Segment line, boolean soft)
    • has

      public boolean has(Vector3 point)
    • intersectsWith

      public boolean intersectsWith(Segment line)
    • segmentsIntersect

      private boolean segmentsIntersect(ScreenPoint p1, ScreenPoint p2, ScreenPoint q1, ScreenPoint q2)
    • orientation

      private int orientation(ScreenPoint a, ScreenPoint b, ScreenPoint c)
    • onSegment

      private boolean onSegment(ScreenPoint a, ScreenPoint b, ScreenPoint c)