javafx.geometry.BoundingBox
2013-04-29 19:39
274 查看
public class BoundingBox extends Bounds
A rectangular bounding(边界) box which is used to describe the bounds of a node or other scene graph object.
BoundingBox
public BoundingBox(double minX,double minY,
double width,
double height)
Creates a new instance of 2D BoundingBox.
Parameters:
minX - the X coordinate of the upper-left cornerminY - the Y coordinate of the upper-left corner
width - the width of the BoundingBox
height - the height of the BoundingBox
BoundingBox
public BoundingBox(double minX,double minY,
double minZ,
double width,
double height,
double depth)
Creates a new instance of 3D BoundingBox.
Parameters:
minX - the X coordinate of the upper-left cornerminY - the Y coordinate of the upper-left corner
minZ - the minimum(最低限度) z coordinate of the BoundingBox
width - the width of the BoundingBox
height - the height of the BoundingBox
depth - the depth of the BoundingBox
contains
public boolean contains(double x, double y)Tests if the specified (x, y) coordinates are inside the boundary of Bounds. The points on the boundary(边界) are considered to lie inside the BoundingBox.
Specified by:
contains in class BoundsParameters:
x - the specified x coordinate to be tested
y - the specified y coordinate to be tested
Returns:
true if the specified (x, y) coordinates are inside the boundary of this Bounds; false otherwise.isEmpty
public boolean isEmpty()Indicates whether any of the dimensions(尺寸)(width, height or depth) of this bounds is less than zero.
Specified by:
isEmpty in class Bounds
Returns:
true if any of the dimensions(width, height or depth) of this bounds is less than zero.
intersects(相交)
public boolean intersects(Bounds b)Tests if the interior(内部) of this Bounds intersects the interior(内部) of a specified Bounds, b.
Specified by:
intersects in class BoundsParameters:
b - The specified Bounds
Returns:
true if the interior of this Bounds and the interior of the specified Bounds, b, intersect.
java代码:
package geometry; import javafx.geometry.BoundingBox; public class TestBoundingBox{ public static void main(String[] args) { BoundingBox boundingBox = new BoundingBox(0,0,18.2,28.9); BoundingBox boundingBox2 = new BoundingBox(0,0,0,18.2,28.9,8); System.out.println(boundingBox.contains(3, 5)); //某个点是否在这个界限内 true System.out.println(boundingBox.contains(30, 5));//false BoundingBox boundingBox3 = new BoundingBox(0,0,0,-9); //一定要小于0才返回true,等于0都不返回,难道此方法是用来检测现在的状态是否正确 //如果一个节点的边界之间相见都小于0了,那这是什么边界?根本就不可能的事情 System.out.println(boundingBox3.isEmpty()); System.out.println(boundingBox.intersects(boundingBox2));//相交 System.out.println(boundingBox.intersects(boundingBox3));//不相交 } }
相关文章推荐
- Cesium AxisAlignedBoundingBox
- Bounding box regression(回归)
- cocos2dx打飞机项目笔记六:GameScene类和碰撞检测 boundingbox
- three.js 源码注释(六十八)extras/geometries/BoxGeometry.js
- poj 2504 Bounding box
- 提取用Bounding box label标记后的误标文件
- 《PCL点云库学习&VS2010(X64)》Part 28 BoundingBox&addArray
- 在ccTouchesBegan 用;boundingBox 判断是不是在操作英雄
- Combo Box JavaFx with FXML
- tf.image.sample_distorted_bounding_box(含其他对图形的操作)
- OrientedBoundingBox 有向包围盒碰撞DEMO (附源码)
- Revit API相交过滤BoundingBoxIntersectsFilter
- Matlab手动绘制bounding box,并获取其坐标
- tf.image.crop_to_bounding_box的用法
- POJ2504 Bounding box
- Combo Box JavaFx with FXML
- 重写boundingBox之--忽略锚点,放缩等因素,得到精灵碰撞区域
- 对 osg::BoundingBox 赋值
- Cocos2d-x之getVisibleSize,getContentSize,boundingBox,getContentSizeInPixels,convertToGL,convertToUI
- 制作自己的数据集 打标签bounding box 之 Windows 10 下python环境安装(PyQt4)