# direct2d how to calc the distance between two path gemory..

• ### 问题

But I still have some questions:

1.much places it mentioned default tolerance, so what is the value, and can we change it?

2.Does it can calc the intersect points of two path gemory, when they are overlap, and whether can calc the distance between the two path gemory when they are disjoint?

3. Outline() just return the result as simiplified edges, how can we make it return outline include arc?

Thank you very much.

2016年1月17日 16:08

### 答案

• Hi，

Thanks for posting here.

1. Flattening tolerances affect how finely curved segments such as arcs and Beziers will be tessellated. When rendering a geometry realization or the output of a geometry operation with the identity transform, the default flattening tolerance (D2D1_DEFAULT_FLATTENING_TOLERANCE) is appropriate. Using the default tolerance with a large scale transform, however, can cause visible faceting. To guard against this, callers should use ComputeFlatteningTolerance and pass in the expected transform that the content will be rendered with and the DPI of the render target the content will be rendered onto.

2. This is a complex issue. A geometric path that can contain lines, arcs, cubic Bezier curves, and quadratic Bezier curves. You may need to get all the segments of the geometric path, then find the intersect area according to segments.

You can refer to the link below to get segments of a path geometry.

How to get the segments of a path geometry in Direct2D?

Then you can refer to the link below to detect the segments intersect. If you want to get intersect area, after you get intersect point, you can caculate the area by yourself.

How do you detect where two line segments intersect?

As to the distance between two path geometrys, I think this depends on what kind of path geometry you want to caculate. For example, arcs or curves or some other closed curve graph.

3.

May

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.