java 怎么判断一个点是否位于一个图形的边界上,比如是否在一条线上?
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/28 01:57:44
java 怎么判断一个点是否位于一个图形的边界上,比如是否在一条线上?
graphics对象画出来的图形好像不能判断是否包含一个点,我要做一个画图程序,怎么才能知道一个点是否在画出来的图形的边界上?
graphics对象画出来的图形好像不能判断是否包含一个点,我要做一个画图程序,怎么才能知道一个点是否在画出来的图形的边界上?
使用Shape类.Graphics/Graphics2D的 draw(shape)这个方法.
Shape有contains方法判断
boolean
contains(double x,
double y)
Tests if the specified coordinates are inside the boundary of the
Shape, as described by the
definition of insideness.
boolean
contains(double x,
double y,
double w,
double h)
Tests if the interior of the Shape entirely contains
the specified rectangular area.
boolean
contains(Point2D p)
Tests if a specified Point2D is inside the boundary
of the Shape, as described by the
definition of insideness.
boolean
contains(Rectangle2D r)
Tests if the interior of the Shape entirely contains the
specified Rectangle2D.
再问: shape怎么定义一个圆啊。。。就比如要用 Shape []shape= new Shape[5] draw(shape[0])画一个圆,那应该怎么定义这个shape[0]啊
再答: Ellipse2D 这个椭圆类用来画圆shape[0] = new Ellipse2D.Double(0,0,30,30);
Shape有contains方法判断
boolean
contains(double x,
double y)
Tests if the specified coordinates are inside the boundary of the
Shape, as described by the
definition of insideness.
boolean
contains(double x,
double y,
double w,
double h)
Tests if the interior of the Shape entirely contains
the specified rectangular area.
boolean
contains(Point2D p)
Tests if a specified Point2D is inside the boundary
of the Shape, as described by the
definition of insideness.
boolean
contains(Rectangle2D r)
Tests if the interior of the Shape entirely contains the
specified Rectangle2D.
再问: shape怎么定义一个圆啊。。。就比如要用 Shape []shape= new Shape[5] draw(shape[0])画一个圆,那应该怎么定义这个shape[0]啊
再答: Ellipse2D 这个椭圆类用来画圆shape[0] = new Ellipse2D.Double(0,0,30,30);
编写java程序,输入两个实数x,y,用来代表一个点的坐标,判断该点是否在单位圆(半径为1.0的圆)上.
java中如何判断一个日期是否在一段时间之内
怎么判断一个点是否是落在一个封闭图形中?
怎么判断一个函数在某点是否可积
在cad绘图 怎么在一条线上确定一个点啊 比如说说在这条线的端点20的地方?
在java中设计一个程序,判断直角坐标系中一个点是否在以(0,0)为圆心以1为半径的圆内?
怎样判断一个点是否在一个一次函数的图像上?
怎么判断 一个点是否在一个平面的扇形区域内
级数,怎么判断一个级数是否收敛,比如这个:
在Java中,设计一个算法,判断一个算术表达式中的括号是否配对.
判断一个图案是否是轴对称图形的关键是
给定任何一个正整数,判断这个数是否是质数.java程序怎么写呀,