English 中文(简体)
我怎么能够使地貌学先进操作在蜂蜜的道路上?
原标题:How could I make geometry advanced operations on bezier paths?

我有一个图书馆,利用中点近线,定期收集比照路数(构成许多比方点的复杂路程)。

我可以毫不怀疑地提出这些建议,但我需要为先进的地貌作业提供更多支持: 曲线最接近点,交叉点,数字包含点,更重要的是,path组合:差异、交叉点、排他性、联盟, ......

是否有很好的来源来做到这一点?

增 编

问题回答

我不得不在 cur或封闭的道路上实施其中一些行动。 大部分锅炉.到底线和多管。 几个有用的概念:

  1. The control points form a convex hull around the Bezier path, which is useful to short circuit intersection-related operations.
  2. Your curve subdivision should be adaptive, stopping when the next subdivision won t be a significant difference, which means each "half" may divide to a different depth.
  3. You can subdivide a curve at any point, not just the midpoint, which is useful for creating a Bezier subcurve ending at a found interestion point.

任意分区的示范守则:

 static Point2D.Double[][] splitBezier(Point2D.Double[] p) {
     return splitBezier(p, 0.5);
 }

 static Point2D.Double[][] splitBezier(Point2D.Double[] p, double t) {
    Point2D.Double[][] parts = new Point2D.Double[2][4];
    Point2D.Double ab = interpolate(t, p[0], p[1]);
    Point2D.Double bc = interpolate(t, p[1], p[2]);
    Point2D.Double cd = interpolate(t, p[2], p[3]);
    Point2D.Double abc = interpolate(t, ab, bc);
    Point2D.Double bcd = interpolate(t, bc, cd);
    Point2D.Double abcd = interpolate(t, abc, bcd);
    parts[0][0] = p[0];
    parts[0][1] = ab;
    parts[0][2] = abc;
    parts[0][3] = abcd;
    parts[1][0] = abcd;
    parts[1][2] = bcd;
    parts[1][2] = cd;
    parts[1][3] = p[3];
    return parts;
 }

 static Point2D.Double interpolate(double t, Point2D.Double a, Point2D.Double b) {
    return new Point2D.Double((1 - t) * a.getX() + t * b.getX(),
                              (1 - t) * a.getY() + t * b.getY());
 }

一些有用的网站:





相关问题
Bounding ellipse

I have been given an assignement for a graphics module, one part of which is to calculate the minimum bounding ellipse of a set of arbitrary shapes. The ellipse doesn t have to be axis aligned. This ...

Line segment in a triangle

How can we check if a line segment falls partially or fully inside a triangle? Cheers.

Line Segments from a point

I have a point p, and 2 line segments in a 2D plane. Point p is a location of view from where camera is looking towards the line segments. I want to check if line segment 1 is partially or fully ...

Creating a surface of triangles from a set of 2D points

I have a set of points and I need to convert the set to (non-overlapping) triangles (or a big polygon if equivalent)... The application: I have a list of locations (latitude,longitude) from a country,...

Radial plotting algorithm

I have to write an algorithm in AS3.0 that plots the location of points radially. I d like to input a radius and an angle at which the point should be placed. Obviously I remember from geometry ...

Delete holes in a Polygon

I have a polygon determined by an Array of Points. This polygon is crossing itself making some holes in the polygon itself. My questions is: How can I omit this holes and just get the exterior ...

Finding cycle of 3 nodes ( or triangles) in a graph

I am working with complex networks. I want to find group of nodes which forms a cycle of 3 nodes (or triangles) in a given graph. As my graph contains about million edges, using a simple iterative ...

热门标签