本文整理汇总了Java中math.geom2d.Point2D.midPoint方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.midPoint方法的具体用法?Java Point2D.midPoint怎么用?Java Point2D.midPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math.geom2d.Point2D
的用法示例。
在下文中一共展示了Point2D.midPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCircularCap
import math.geom2d.Point2D; //导入方法依赖的package包/类
private static CircleArc2D createCircularCap(Point2D p1, Point2D p2){
Point2D center = Point2D.midPoint(p1, p2);
double radius = p1.getDistance(p2)/2;
double angle1 = Angle2D.getHorizontalAngle(center, p1);
double angle2 = Angle2D.getHorizontalAngle(center, p2);
return CircleArc2D.create(center, radius, angle1, angle2, true);
}
示例2: createMedian
import math.geom2d.Point2D; //导入方法依赖的package包/类
/**
* Creates a median between 2 points.
*
* @param p1 one point
* @param p2 another point
* @return the median of points p1 and p2
* @since 0.6.3
*/
public final static StraightLine2D createMedian(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2) {
Point2D mid = Point2D.midPoint(p1, p2);
StraightLine2D line = StraightLine2D.create(p1, p2);
return StraightLine2D.createPerpendicular(line, mid);
}
示例3: createMedian2D
import math.geom2d.Point2D; //导入方法依赖的package包/类
/**
* Creates a median between 2 points.
*
* @param p1 one point
* @param p2 another point
* @return the median of points p1 and p2
* @deprecated since 0.6.3, use createMedian instead
*/
@Deprecated
public final static StraightLine2D createMedian2D(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2) {
Point2D mid = Point2D.midPoint(p1, p2);
StraightLine2D line = StraightLine2D.create(p1, p2);
return StraightLine2D.createPerpendicular(line, mid);
}