![JAR search and dependency download from the Maven repository](/logo.png)
de.tsl2.nano.math.vector.Rectangle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.logicstructure Show documentation
Show all versions of tsl2.nano.logicstructure Show documentation
TSL2 Framework LogicTable/Tree/Vector (Excel-like table logic with equation solving through tsl2.nano.operation, mathemical Vector/Matrix-calculation)
The newest version!
/*
* File: $HeadURL$
* Id : $Id$
*
* created by: ts
* created on: 09.04.2012
*
* Copyright: (c) Thomas Schneider 2012, all rights reserved
*/
package de.tsl2.nano.math.vector;
/**
* Simple 2-dim rectangle definition, working on floats
*
* @author ts
* @version $Revision$
*/
public class Rectangle extends Coordinate {
/** serialVersionUID */
private static final long serialVersionUID = 1L;
public Rectangle(float x, float y, float w, float h) {
super(x, y, w, h);
}
/**
* x
*
* @return x-coordinate
*/
public float x() {
return x[0];
}
/**
* y
*
* @return y-coordinate
*/
public float y() {
return x[1];
}
/**
* w
*
* @return width
*/
public float w() {
return x[2];
}
/**
* h
*
* @return height
*/
public float h() {
return x[3];
}
/**
* checks, whether given point is contained in current rectangle
*
* @param x x-coordinate
* @param y y-coordinate
* @return true, if point x, y is contained
*/
public boolean contains(float x, float y) {
return x() <= x && x <= x() + w() && y() <= y && y <= y() + h();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy