Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## modelling
Class CircularArea

    java.lang.Object
      modelling.CircularArea

All Implemented Interfaces:
  Area

public class CircularArea
extends java.lang.Object
implements Area

Implements circular area. The boxes coverage is a square containing the area

Field Summary
`float` | `sqr2`
`float` | `sqr2s2`

Constructor Summary
`CircularArea(Map map, float x, float y, float radius, float angle)`

Method Summary
`java.lang.Object` | `clone()` Clone the area.
`void` | `confirmSimuled()` Confirms the last move simulated with a simule method of the area.
`void` | `draw(Drawing g)` Draws the `Area` and eventually the image of the associated element.
`void` | `drawBorder(Drawing g, java.awt.Color c)` Draws the borders of the area with the given color.
`boolean` | `exactIsCrashingElements()` Takes in argument a vector v returned by a simule method.
`boolean` | `exactIsCrashingElements(java.util.Vector v)`
`void` | `fill(Drawing g, java.awt.Color c)` Fills the area with the given color.
`float` | `getAngle()` Returns the orientation ( in Radian )
`java.util.Vector` | `getIntersectedBoxes()` Returns at least the boxes intersected by the area.
`java.util.Vector` | `getPolygon()` Returns a polygon aproximating the area.
`java.lang.String[][]` | `getProperties()` Returns the Area's properties.
`float` | `getX()` Returns the x-coordinate of the area's reference point.
`float` | `getY()` Returns the y-coordinate of the area's reference point.
`void` | `highlight(Drawing g, java.awt.Color c)` Highlights the `Area`. is used when it's selected in the interface.
`boolean` | `inMap()` Checks whether the area is included in te map.
`boolean` | `intersect(Area a)` Returns whether the area intersect these one.
`boolean` | `intersect(float ax, float ay, float bx, float by)` Returns whether the area intersect the segment (ax,ay),(bx,by)
`boolean` | `intersect(java.util.Vector p1)` Returns whether the polygon intersects this area.
`boolean` | `isCrashingElements()` Rounded here, because of the approximate covering boxes (there would be undue collisions!).
`boolean` | `isCrashingElements(java.util.Vector v)`
`boolean` | `isIn(float px, float py)` Returns whether the point is in the area.
`boolean` | `isPolygon()` Returns whether the area is a polygon.
`boolean` | `rescale(float x, float y)` Rescale by a 'x' and a 'y' factor without going out of the `Map`.
`boolean` | `rotate(float angle)` Rotates the area by the angle around the reference point `getX()` without going out of the `Map`.
`boolean` | `setAngle(float a)` Sets the orientation ( in radian ) Returns true if the modification is done, else false.
`void` | `setElement(Element el)` Sets the element to which we want to link the area.
`void` | `setProperties(java.lang.String s1, java.lang.String s2)` Sets the value of a property of the area.
`boolean` | `setRadius(float r)`
`boolean` | `setX(float x)` Modify the x-coordinate of the reference point, without going out of the `` .
`boolean` | `setY(float y)` Modify the y-coordinate of the reference point, without going out of the `` .
`java.util.Vector` | `simuleRescale(float xS, float yS)` Returns the covering boxes which would result of the rescale.
`java.util.Vector` | `simuleRotate(float angle)` Returns the covering boxes which would result of the rotation.
`java.util.Vector` | `simuleTranslate(float x, float y)` Returns the covering boxes which would result of the (x,y) translation of the area.
`boolean` | `translate(float x, float y)` Translates the area by the (x,y) vector without going out of the map.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### sqr2

    public final float sqr2

### sqr2s2

    public final float sqr2s2

Constructor Detail

### CircularArea

    public CircularArea(Map map,
                        float x,
                        float y,
                        float radius,
                        float angle)

Method Detail

### getIntersectedBoxes

    public java.util.Vector getIntersectedBoxes()

  Description copied from interface: `Area`
  Returns at least the boxes intersected by the area. A simplified vision can be used to computes the intersected boxes but il must respect this condition.

  Specified by:
    `getIntersectedBoxes` in interface `Area`
  Returns:
    the boxes intersected by the area.
  See Also:
    `Area.setElement(Element)`, `Box.register(Element)`, `Box.unregister(Element)`

### setElement

    public void setElement(Element el)

  Description copied from interface: `Area`
  Sets the element to which we want to link the area. Indeed, when the area is used to represent the shape of an element, it must know him in order to manage the covered boxes.

  Specified by:
    `setElement` in interface `Area`
  Parameters:
    `el` - the corresponding element ( if one is used ).

### getX

    public float getX()

  Description copied from interface: `Area`
  Returns the x-coordinate of the area's reference point. This point is the one used to rotate around, and is used to represent the coordinate of an element if one is tied to this shape.

  Specified by:
    `getX` in interface `Area`
  Returns:
    the x-coordinate of the area's reference point.

### getY

    public float getY()

  Description copied from interface: `Area`
  Returns the y-coordinate of the area's reference point. This point is the one used to rotate around, and is used to represent the coordinate of an element if one is tied to this shape.

  Specified by:
    `getY` in interface `Area`
  Returns:
    the y-coordinate of the area's reference point.

### getAngle

    public float getAngle()

  Description copied from interface: `Area`
  Returns the orientation ( in Radian )

  Specified by:
    `getAngle` in interface `Area`
  Returns:
    the orientation ( in Radian )

### isIn

    public boolean isIn(float px,
                        float py)

  Description copied from interface: `Area`
  Returns whether the point is in the area.

  Specified by:
    `isIn` in interface `Area`
  Parameters:
    `px` - the x-coordinate of the point.
    `py` - the y-coordinate of the point.
  Returns:
    whether the point is in the area.

### isCrashingElements

    public boolean isCrashingElements()

  Rounded here, because of the approximate covering boxes (there would be undue collisions!). This is because this area is designed to be fast. The elementsCollision should be used for this kind of area. However, the box-base collision is always an approximation!

  Specified by:
    `isCrashingElements` in interface `Area`
  Returns:
    whether there are elements registered on the area's boxes.

### isCrashingElements

    public boolean isCrashingElements(java.util.Vector v)

  Specified by:
    `isCrashingElements` in interface `Area`

### isPolygon

    public boolean isPolygon()

  Description copied from interface: `Area`
  Returns whether the area is a polygon.

  Specified by:
    `isPolygon` in interface `Area`
  Returns:
    whether the area is a polygon.

### getPolygon

    public java.util.Vector getPolygon()

  Description copied from interface: `Area`
  Returns a polygon aproximating the area. It's represented as a vector of edges in the trigonometric order.

  Specified by:
    `getPolygon` in interface `Area`
  Returns:
    a polygone aproximating the area.

### intersect

    public boolean intersect(float ax,
                             float ay,
                             float bx,
                             float by)

  Description copied from interface: `Area`
  Returns whether the area intersect the segment (ax,ay),(bx,by)

  Specified by:
    `intersect` in interface `Area`
  Parameters:
    `ax` - x-coordinate of the 'a' point.
    `ay` - y-coordinate of the 'a' point.
    `bx` - x-coordinate of the 'b' point.
    `by` - y-coordinate of the 'b' point.
  Returns:
    whether the area intersect the segment (ax,ay),(bx,by)

### intersect

    public boolean intersect(java.util.Vector p1)

  Description copied from interface: `Area`
  Returns whether the polygon intersects this area.

  Specified by:
    `intersect` in interface `Area`
  Parameters:
    `p1` - the polygon to test.`Area.getPolygon()`
  Returns:
    whether the polygon intersects this area.

### intersect

    public boolean intersect(Area a)

  Description copied from interface: `Area`
  Returns whether the area intersect these one. Indeed it verify whether their is an intersection between the polygone of one with the other or the opposite. It respects : a.intersect(b) == b.intersect(a).

  Specified by:
    `intersect` in interface `Area`
  Parameters:
    `a` - the area to test.
  Returns:
    whether the area intersect these one.

### exactIsCrashingElements

    public boolean exactIsCrashingElements()

  Description copied from interface: `Area`
  Takes in argument a vector v returned by a simule method. Returns true if there is any collision with the elements, or if the area is not included in the map (going out of the map is, by default, considered as a crash with the map, and that means that v is null). It computes a real intersection between the area of the elements registered in the covering boxes. This is an exact method that can be called by an element to verify that his new position satisfies physical laws in 2D. If it returns true, it means that the element has a valid position: he is in the map and does not intersect other elements. There is no false positives. The `Area.isCrashingElements()` is a fast approximation of this method.

  Specified by:
    `exactIsCrashingElements` in interface `Area`
  Returns:
    whether there are elements collision.

### exactIsCrashingElements

    public boolean exactIsCrashingElements(java.util.Vector v)

  Specified by:
    `exactIsCrashingElements` in interface `Area`

### translate

    public boolean translate(float x,
                             float y)

  Description copied from interface: `Area`
  Translates the area by the (x,y) vector without going out of the map. Returns true if the modification is done (can be done).

  Specified by:
    `translate` in interface `Area`
  Parameters:
    `x` - x-coordinate of the translation vector.
    `y` - x-coordinate of the translation vector.
  Returns:
    true if the modification is done (can be done).

### setRadius

    public boolean setRadius(float r)

### setX

    public boolean setX(float x)

  Description copied from interface: `Area`
  Modify the x-coordinate of the reference point, without going out of the `` . Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.

  Specified by:
    `setX` in interface `Area`
  Parameters:
    `x` - the x-coordinate of the reference point.
  Returns:
    whether the modification is done.
  See Also:
    `Area.getX()`

### setY

    public boolean setY(float y)

  Description copied from interface: `Area`
  Modify the y-coordinate of the reference point, without going out of the `` . Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.

  Specified by:
    `setY` in interface `Area`
  Parameters:
    `y` - the y-coordinate of the reference point.
  Returns:
    whether the modification is done.
  See Also:
    `Area.getY()`

### simuleTranslate

    public java.util.Vector simuleTranslate(float x,
                                            float y)

  Description copied from interface: `Area`
  Returns the covering boxes which would result of the (x,y) translation of the area. It's used to foresee your position and so determine whether you can move. Null if out of the map.

  Specified by:
    `simuleTranslate` in interface `Area`
  Parameters:
    `x` - the x-coordinate of the translation.
    `y` - the y-coordinate of the translation.
  Returns:
    the covering boxes which would result of the (x,y) translation of the area.

### confirmSimuled

    public void confirmSimuled()

  Description copied from interface: `Area`
  Confirms the last move simulated with a simule method of the area. The interest of using these two separate fonctions is to allow the collision detections or other computation before confirming the move. So, it is possible for an element to know the boxes that it would occupy after a spcified move, and then it can decide whether this move is suitable for it. We gain a lot of time here, not computing two times the same thing.

  Specified by:
    `confirmSimuled` in interface `Area`

### rotate

    public boolean rotate(float angle)

  Description copied from interface: `Area`
  Rotates the area by the angle around the reference point `Area.getX()` without going out of the `Map`. Returns true if the transformation has been done, false otherwise.

  Specified by:
    `rotate` in interface `Area`
  Parameters:
    `angle` - the angle of the rotation ( in radian )
  Returns:
    true if the transformation has been done, false otherwise.

### setAngle

    public boolean setAngle(float a)

  Description copied from interface: `Area`
  Sets the orientation ( in radian ) Returns true if the modification is done, else false.

  Specified by:
    `setAngle` in interface `Area`
  Parameters:
    `a` - Sets the orientation ( in radian )
  Returns:
    Returns true if the modification is done, else false.

### simuleRotate

    public java.util.Vector simuleRotate(float angle)

  Description copied from interface: `Area`
  Returns the covering boxes which would result of the rotation. Null if out of the map.

  Specified by:
    `simuleRotate` in interface `Area`
  Parameters:
    `angle` - the angle of the simulated rotation.
  Returns:
    the covering boxes which would result of the rotation.

### rescale

    public boolean rescale(float x,
                           float y)

  Description copied from interface: `Area`
  Rescale by a 'x' and a 'y' factor without going out of the `Map`. Returns true if the transformation has been done, false otherwise.

  Specified by:
    `rescale` in interface `Area`
  Parameters:
    `x` - the x-factor.
    `y` - the y-factor.
  Returns:
    true if the transformation has been done, false otherwise.

### simuleRescale

    public java.util.Vector simuleRescale(float xS,
                                          float yS)

  Description copied from interface: `Area`
  Returns the covering boxes which would result of the rescale. Null if goes out of the map.

  Specified by:
    `simuleRescale` in interface `Area`
  Parameters:
    `xS` - the x-factor of the simulated rescale.
    `yS` - the y-factor of the simulated rescale.
  Returns:
    the covering boxes which would result of the rescale.

### inMap

    public boolean inMap()

  Description copied from interface: `Area`
  Checks whether the area is included in te map.

  Specified by:
    `inMap` in interface `Area`

### draw

    public void draw(Drawing g)

  Description copied from interface: `Area`
  Draws the `Area` and eventually the image of the associated element. It gives a default method to draw elements.

  Specified by:
    `draw` in interface `Area`
  Parameters:
    `g` - the `Drawing` object containing the graphics context.

### fill

    public void fill(Drawing g,
                     java.awt.Color c)

  Description copied from interface: `Area`
  Fills the area with the given color.

  Specified by:
    `fill` in interface `Area`

### drawBorder

    public void drawBorder(Drawing g,
                           java.awt.Color c)

  Description copied from interface: `Area`
  Draws the borders of the area with the given color.

  Specified by:
    `drawBorder` in interface `Area`

### highlight

    public void highlight(Drawing g,
                          java.awt.Color c)

  Description copied from interface: `Area`
  Highlights the `Area`. is used when it's selected in the interface. It's better to give a transparent color in order to have something nice.

  Specified by:
    `highlight` in interface `Area`
  Parameters:
    `g` - the `Drawing` object.
    `c` - the `Color` used to highlight.

### getProperties

    public java.lang.String[][] getProperties()

  Description copied from interface: `Area`
  Returns the Area's properties.

  Specified by:
    `getProperties` in interface `Area`
  Returns:
    the element's properties.
  See Also:
    `Engine.getProperties()`

### setProperties

    public void setProperties(java.lang.String s1,
                              java.lang.String s2)

  Description copied from interface: `Area`
  Sets the value of a property of the area. The new value is ignored if the property is read_only or if the value isn't valid.

  Specified by:
    `setProperties` in interface `Area`
  Parameters:
    `s1` - the property to change.
    `s2` - the new value for the property.
  See Also:
    `Engine.setProperties(java.lang.String, java.lang.String)`

### clone

    public java.lang.Object clone()

  Description copied from interface: `Area`
  Clone the area.

  Specified by:
    `clone` in interface `Area`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD