Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'getMin'/'getMax' to Rectangled/f/i #26

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,30 @@ public interface Rectangledc {

double minY();

/**
* Return the minimum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2d getMin(Vector2d dest) {
return dest.set(minX(), minY());
}

double maxX();

double maxY();

/**
* Return the maximum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2d getMax(Vector2d dest) {
return dest.set(maxX(), maxY());
}

/**
* Return the length of the rectangle in the X dimension.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package org.terasology.joml.geom;

import org.joml.Math;
import org.joml.Vector2d;
import org.joml.Vector2dc;
import org.joml.Vector2f;
import org.joml.Vector2fc;
Expand All @@ -14,10 +15,30 @@ public interface Rectanglefc {

float minY();

/**
* Return the minimum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2f getMin(Vector2f dest) {
return dest.set(minX(), minY());
}

float maxX();

float maxY();

/**
* Return the maximum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2f getMax(Vector2f dest) {
return dest.set(maxX(), maxY());
}

/**
* Return the length of the rectangle in the X dimension.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.joml.geom;

import org.joml.Vector2d;
import org.joml.Vector2dc;
import org.joml.Vector2fc;
import org.joml.Vector2i;
Expand All @@ -13,10 +14,30 @@ public interface Rectangleic {

int minY();

/**
* Return the minimum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2i getMin(Vector2i dest) {
return dest.set(minX(), minY());
}

int maxX();

int maxY();

/**
* Return the maximum corner of this rectangle.
*
* @param dest will hold the result
* @return dest
*/
default Vector2i getMax(Vector2i dest) {
return dest.set(maxX(), maxY());
}

/**
* Return the length of the rectangle in the X dimension.
*
Expand Down