Package net.apartium.cocoabeans.space
Interface Region
- All Known Implementing Classes:
BoxRegion,SphereRegion
@AvailableSince("0.0.22")
public interface Region
Represents a region between 2 positions
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic BoxRegionCreate a box region between 2 positionsbooleanCheck if the position is in the regiondoubleReturn the distance between region and position If position is inside the region, return 0 (Note that this is not the same as the distance between the region and the center of the region) (Note this method is more expensive thancontains(Position)method when you just want to check if the position is inside the region)static SphereRegionCreate a sphere region with center and radius
-
Method Details
-
box
Create a box region between 2 positions- Parameters:
pos0- position 0pos1- position 1- Returns:
- a new box region instance
-
sphere
Create a sphere region with center and radius- Parameters:
center- center of the sphereradius- radius of the sphere- Returns:
- a new sphere region instance
-
contains
Check if the position is in the region- Parameters:
position- position to check- Returns:
- true if the position is in the region or false otherwise
-
distance
Return the distance between region and position If position is inside the region, return 0 (Note that this is not the same as the distance between the region and the center of the region) (Note this method is more expensive thancontains(Position)method when you just want to check if the position is inside the region)- Parameters:
position- position- Returns:
- distance between region and position (or 0 if position is inside the region)
-