DistancePredicate
Represents a predicate for distance.
The predicate can effectively be used to check the distance between two coordinates in 3D-space. The distance will firstly be checked separately against the x, y, and z bounds that have been specified. If those checks succeed, then horizontal distance will be taken into consideration, measuring the distance between the two points only along the X and Z axis. Lastly, the absolute distance considering all axis will be checked.
Any of the above checks will be skipped if no value has been specified for any of them. By default, the predicate will not add any restrictions on the distance between two points.
导入相关包
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Extending AnyDefaultingVanillaWrappingPredicate
DistancePredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in DistancePredicate
方法
withMaximumAbsoluteDistance
Sets the maximum value the absolute distance should be to max
.
If the absolute distance had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in max
. On the other hand, if the absolute distance didn't have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Return Type: DistancePredicate
withMaximumHorizontalDistance
Sets the maximum value the horizontal distance should be to max
.
If the horizontal distance had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in max
. On the other hand, if the horizontal distance didn't have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Return Type: DistancePredicate
withMaximumX
Sets the maximum value the distance along the X axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in max
. On the other hand, if the distance didn't have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Return Type: DistancePredicate
withMaximumY
Sets the maximum value the distance along the Y axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in max
. On the other hand, if the distance didn't have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Return Type: DistancePredicate
withMaximumZ
Sets the maximum value the distance along the Z axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in max
. On the other hand, if the distance didn't have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Return Type: DistancePredicate
withMinimumAbsoluteDistance
Sets the minimum value the absolute distance should be to min
.
If the absolute distance had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in min
. On the other hand, if the absolute distance didn't have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Return Type: DistancePredicate
withMinimumHorizontalDistance
Sets the minimum value the horizontal distance should be to min
.
If the horizontal distance had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in min
. On the other hand, if the horizontal distance didn't have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Return Type: DistancePredicate
withMinimumX
Sets the minimum value the distance along the X axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in min
. On the other hand, if the distance didn't have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Return Type: DistancePredicate
withMinimumY
Sets the minimum value the distance along the Y axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in min
. On the other hand, if the distance didn't have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Return Type: DistancePredicate
withMinimumZ
Sets the minimum value the distance along the Z axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in min
. On the other hand, if the distance didn't have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Return Type: DistancePredicate
withRangedAbsoluteDistance
Sets both the minimum and maximum value the absolute distance should be to min
and max
respectively.
If the absolute distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Return Type: DistancePredicate
withRangedHorizontalDistance
Sets both the minimum and maximum value the horizontal distance should be to min
and
max
respectively.
If the horizontal distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Return Type: DistancePredicate
withRangedX
Sets both the minimum and maximum value the distance along the X axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Return Type: DistancePredicate
withRangedY
Sets both the minimum and maximum value the distance along the Y axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Return Type: DistancePredicate
withRangedZ
Sets both the minimum and maximum value the distance along the Z axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Return Type: DistancePredicate