• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Polyline2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中math.geom2d.polygon.Polyline2D的典型用法代码示例。如果您正苦于以下问题:Java Polyline2D类的具体用法?Java Polyline2D怎么用?Java Polyline2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Polyline2D类属于math.geom2d.polygon包,在下文中一共展示了Polyline2D类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: asPolylineOpen

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Assumes the curve is open, and returns an instance of Polyline2D.
 * 
 * @param n
 *            the number of edges of the resulting polyline
 * @return a new Polyline2D approximating the original curve
 */
protected Polyline2D asPolylineOpen(int n) {
    // Check that the curve is bounded
    if (!this.isBounded())
        throw new UnboundedShape2DException(this);

    // compute start and increment values
    double t0 = this.t0();
    double dt = (this.t1() - t0) / n;

    // allocate array of points, and compute each value.
    // Computes also value for last point.
    Point2D[] points = new Point2D[n + 1];
    for (int i = 0; i < n + 1; i++)
        points[i] = this.point(t0 + i * dt);

    return new Polyline2D(points);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:25,代码来源:AbstractContinuousCurve2D.java


示例2: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public Polyline2D asPolyline(int n) {
	// Check that the curve is bounded
       if (!this.isBounded())
           throw new UnboundedShape2DException(this);

       // compute start and increment values
       double t0 = this.t0();
       double dt = (this.t1() - t0) / n;

       // allocate array of points, and compute each value.
       Point2D[] points = new Point2D[n+1];
       for(int i = 0; i < n+1;i++)
       	points[i] = this.point(t0 + i*dt);

       return new Polyline2D(points);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:17,代码来源:ParabolaArc2D.java


示例3: getAsPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public Polyline2D getAsPolyline(int n) {
    Point2D[] points = new Point2D[n+1];
    double t0 = this.getT0();
    double t1 = this.getT1();
    double dt = (t1-t0)/n;
    for (int i = 0; i<n; i++)
        points[i] = this.getPoint(i*dt+t0);
    return new Polyline2D(points);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:10,代码来源:PolyCurve2D.java


示例4: getBoundaryPortion

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Extracts a portion of the boundary of a bounded box.
 * 
 * @param box the box from which one extract a portion of boundary
 * @param p0 the first point of the portion
 * @param p1 the last point of the portion
 * @return the portion of the bounding box boundary as a Polyline2D
 */
public final static Polyline2D getBoundaryPortion(Box2D box, Point2D p0,
        Point2D p1) {
    Boundary2D boundary = box.getBoundary();

    // position of start and end points
    double t0 = boundary.getPosition(p0);
    double t1 = boundary.getPosition(p1);

    // curve index of each point
    int ind0 = (int) Math.floor(t0);
    int ind1 = (int) Math.floor(t1);

    // Simple case: returns a polyline with only 2 vertices
    if (ind0==ind1&&t0<t1)
        return new Polyline2D(new Point2D[] { p0, p1 });

    // Create an array to store vertices
    // Array can contain at most 6 vertices: 4 for the box corners,
    // and 2 for curve extremities.
    ArrayList<Point2D> vertices = new ArrayList<Point2D>(6);

    // add the first point.
    vertices.add(p0);

    // compute index of first box boundary edge
    int ind = (ind0+1)%4;

    // add all vertices segments between the 2 end points
    while (ind!=ind1) {
        vertices.add(boundary.getPoint(ind));
        ind = (ind+1)%4;
    }
    vertices.add(boundary.getPoint(ind));

    // add the last line segment
    vertices.add(p1);

    return new Polyline2D(vertices);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:48,代码来源:Boundary2DUtils.java


示例5: createRectangle

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
private Polyline2D createRectangle(GraphicInfo graphicInfo) {
    Polyline2D rectangle = new Polyline2D(new Point2D(graphicInfo.getX(),
            graphicInfo.getY()), new Point2D(graphicInfo.getX()
            + graphicInfo.getWidth(), graphicInfo.getY()), new Point2D(
            graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY()
                    + graphicInfo.getHeight()), new Point2D(
            graphicInfo.getX(), graphicInfo.getY()
                    + graphicInfo.getHeight()), new Point2D(
            graphicInfo.getX(), graphicInfo.getY()));

    return rectangle;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:13,代码来源:BpmnJsonConverter.java


示例6: createGateway

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
private Polyline2D createGateway(GraphicInfo graphicInfo) {
    double middleX = graphicInfo.getX() + (graphicInfo.getWidth() / 2);
    double middleY = graphicInfo.getY() + (graphicInfo.getHeight() / 2);

    Polyline2D gatewayRectangle = new Polyline2D(new Point2D(
            graphicInfo.getX(), middleY), new Point2D(middleX,
            graphicInfo.getY()), new Point2D(graphicInfo.getX()
            + graphicInfo.getWidth(), middleY), new Point2D(middleX,
            graphicInfo.getY() + graphicInfo.getHeight()), new Point2D(
            graphicInfo.getX(), middleY));

    return gatewayRectangle;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:14,代码来源:BpmnJsonConverter.java


示例7: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Converts this PolyCurve2D into a polyline with the given number of edges.
 * 
 * @param n
 *            the number of edges of the result polyline
 * @see Polyline2D
 */
public Polyline2D asPolyline(int n) {
    Point2D[] points = new Point2D[n + 1];
    double t0 = this.t0();
    double t1 = this.t1();
    double dt = (t1 - t0) / n;
    for (int i = 0; i < n; i++)
        points[i] = this.point(i * dt + t0);
    return new Polyline2D(points);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:17,代码来源:PolyCurve2D.java


示例8: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public Polyline2D asPolyline(int n) {

        // compute increment value
        double dt = 1.0 / n;

        // allocate array of points, and compute each value.
        // Computes also value for last point.
        Point2D[] points = new Point2D[n + 1];
        for (int i = 0; i < n + 1; i++)
            points[i] = this.point(i * dt);

        return new Polyline2D(points);
    }
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:14,代码来源:QuadBezierCurve2D.java


示例9: createCap

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public CirculinearContinuousCurve2D createCap(Point2D center,
		Vector2D direction, double dist) {
	double theta = direction.angle();
	Point2D p1 = Point2D.createPolar(center, dist, theta-Math.PI/2);
	Point2D p2 = Point2D.createPolar(center, dist, theta);
	Point2D p3 = Point2D.createPolar(center, dist, theta+Math.PI/2);
	return new Polyline2D(new Point2D[]{p1, p2, p3});
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:9,代码来源:TriangleCapFactory.java


示例10: createCap

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Portion of code shared by the two public methods.
 */
private Polyline2D createCap(Point2D center, double theta, double dist) {
	Point2D p1 = Point2D.createPolar(center, dist, theta-Math.PI/2);
	Point2D p4 = Point2D.createPolar(center, dist, theta+Math.PI/2);
	Point2D p2 = Point2D.createPolar(p1, dist, theta);
	Point2D p3 = Point2D.createPolar(p4, dist, theta);
	return new Polyline2D(new Point2D[]{p1, p2, p3, p4});
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:11,代码来源:SquareCapFactory.java


示例11: getBoundaryPortion

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
   * Extracts a portion of the boundary of a bounded box.
   * 
   * @param box the box from which one extract a portion of boundary
   * @param p0 the first point of the portion
   * @param p1 the last point of the portion
   * @return the portion of the bounding box boundary as a Polyline2D
   */
  public final static Polyline2D getBoundaryPortion(Box2D box, Point2D p0,
          Point2D p1) {
      Boundary2D boundary = box.boundary();

      // position of start and end points
      double t0 = boundary.position(p0);
      double t1 = boundary.position(p1);

      // curve index of each point
      int ind0 = (int) Math.floor(t0);
      int ind1 = (int) Math.floor(t1);

      // Simple case: returns a polyline with only 2 vertices
if (ind0 == ind1 && t0 < t1)
	return new Polyline2D(new Point2D[] { p0, p1 });

      // Create an array to store vertices
      // Array can contain at most 6 vertices: 4 for the box corners,
      // and 2 for curve extremities.
      ArrayList<Point2D> vertices = new ArrayList<Point2D>(6);

      // add the first point.
      vertices.add(p0);

// compute index of first box boundary edge
int ind = (ind0 + 1) % 4;

// add all vertices segments between the 2 end points
while (ind != ind1) {
	vertices.add(boundary.point(ind));
	ind = (ind + 1) % 4;
}
      vertices.add(boundary.point(ind));

      // add the last line segment
      vertices.add(p1);

      return new Polyline2D(vertices);
  }
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:48,代码来源:Boundaries2D.java


示例12: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public Polyline2D asPolyline(int n) {

        // compute increment value
        double dt = Math.abs(this.angleExtent) / n;

        // allocate array of points, and compute each value.
        // Computes also value for last point.
        Point2D[] points = new Point2D[n + 1];
        for (int i = 0; i < n + 1; i++)
            points[i] = this.point(i * dt);

        return new Polyline2D(points);
    }
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:14,代码来源:EllipseArc2D.java


示例13: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
public Polyline2D asPolyline(int n) {

        // compute increment value
        double dt = Math.abs(this.angleExtent) / n;

        // allocate array of points, and compute each value.
        // Computes also value for last point.
        Point2D[] points = new Point2D[n + 1];
        for (int i = 0; i < n + 1; i++)
        	points[i] = this.point(i * dt);

        return new Polyline2D(points);
	}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:14,代码来源:CircleArc2D.java


示例14: createRectangle

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
private Polyline2D createRectangle(Bounds graphicInfo) {
  Polyline2D rectangle = new Polyline2D(new Point2D(graphicInfo.getX(), graphicInfo.getY()),
      new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY()),
      new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY() + graphicInfo.getHeight()),
      new Point2D(graphicInfo.getX(), graphicInfo.getY() + graphicInfo.getHeight()),
      new Point2D(graphicInfo.getX(), graphicInfo.getY()));
  return rectangle;
}
 
开发者ID:fixteam,项目名称:fixflow,代码行数:9,代码来源:BpmnJsonConverter.java


示例15: createGateway

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
private Polyline2D createGateway(Bounds graphicInfo) {
  
  double middleX = graphicInfo.getX() + (graphicInfo.getWidth() / 2);
  double middleY = graphicInfo.getY() + (graphicInfo.getHeight() / 2);
  
  Polyline2D gatewayRectangle = new Polyline2D(new Point2D(graphicInfo.getX(), middleY),
      new Point2D(middleX, graphicInfo.getY()),
      new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), middleY),
      new Point2D(middleX, graphicInfo.getY() + graphicInfo.getHeight()),
      new Point2D(graphicInfo.getX(), middleY));
  
  return gatewayRectangle;
}
 
开发者ID:fixteam,项目名称:fixflow,代码行数:14,代码来源:BpmnJsonConverter.java


示例16: getAsPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
    * Throws an exception when called.
    */
@Override
   public Polyline2D getAsPolyline(int n) {
       throw new UnboundedShapeException(this);
   }
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:8,代码来源:StraightLine2D.java


示例17: asPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Throws an exception when called.
 */
@Override
public Polyline2D asPolyline(int n) {
    throw new UnboundedShape2DException(this);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:8,代码来源:StraightLine2D.java


示例18: getAsPolyline

import math.geom2d.polygon.Polyline2D; //导入依赖的package包/类
/**
 * Returns an approximation of the curve as a polyline with <code>n</code>
 * line segments. If the curve is closed, the method should return an
 * instance of Ring2D.
 * 
 * @param n the number of line segments
 * @return a polyline with <code>n</code> line segments.
 */
public abstract Polyline2D getAsPolyline(int n);
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:10,代码来源:ContinuousCurve2D.java



注:本文中的math.geom2d.polygon.Polyline2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IsEmptyString类代码示例发布时间:2022-05-22
下一篇:
Java MONITOREXIT类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap