mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Gravity and ground height.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import GeometryPoint from "./GeometryPoint.js";
|
||||
import GeometryStroke from "./GeometryStroke.js";
|
||||
import GeometryPointCollection from "./GeometryPointCollection.js";
|
||||
import GeometryLine from "./GeometryLine.js";
|
||||
|
||||
export default class GeometryRect
|
||||
{
|
||||
@@ -26,12 +25,17 @@ export default class GeometryRect
|
||||
*/
|
||||
isContainingPoint(geometryPoint)
|
||||
{
|
||||
let containsHorizontally = geometryPoint.x >= this.position.x && geometryPoint.x <= this.position.x + this.width;
|
||||
let containsVertically = geometryPoint.y >= this.position.y && geometryPoint.y <= this.position.y + this.height;
|
||||
let containsHorizontally = geometryPoint.x >= this.position.x && geometryPoint.x < this.position.x + this.width;
|
||||
let containsVertically = geometryPoint.y >= this.position.y && geometryPoint.y < this.position.y + this.height;
|
||||
|
||||
return containsHorizontally && containsVertically;
|
||||
}
|
||||
|
||||
isEqual(rect)
|
||||
{
|
||||
return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
|
||||
}
|
||||
|
||||
hasIntersectionWithRect(rect)
|
||||
{
|
||||
return this.getBorderIntersectonsWithRect(rect).getLength() > 0;
|
||||
@@ -170,8 +174,8 @@ export default class GeometryRect
|
||||
|
||||
collection.addGeometryPoint(this.position);
|
||||
collection.addGeometryPoint(new GeometryPoint(this.position.x + this.width, this.position.y));
|
||||
collection.addGeometryPoint(new GeometryPoint(this.position.x, this.position.y + this.height));
|
||||
collection.addGeometryPoint(new GeometryPoint(this.position.x + this.width, this.position.y + this.height));
|
||||
collection.addGeometryPoint(new GeometryPoint(this.position.x, this.position.y + this.height - 1));
|
||||
collection.addGeometryPoint(new GeometryPoint(this.position.x + this.width, this.position.y + this.height - 1));
|
||||
|
||||
return collection;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user