blob: 9cfc79cca99a24786a5ed6368dca69e2ea8a6b89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<html>
<head>
<script type="text/javascript" src="../../../../../../Scripts/jquery.js">
</script>
<script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shCore.js">
</script>
<script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushDelphi.js">
</script>
<script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushCpp.js">
</script>
<script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushCSharp.js">
</script>
<link type="text/css" rel="stylesheet" href="../../../../../../Scripts/SyntaxHighlighter/styles/shCoreDefault.css">
<link type="text/css" rel="stylesheet" href="../../../../../../Scripts/SyntaxHighlighter/styles/shThemeDefault.css">
<title>ArcTolerance</title>
<link rel="stylesheet" href="../../../../../../Styles/default.css" type="text/css">
<script type="text/javascript" src="../../../../../../Scripts/bootstrap.js">
</script>
</head>
<body bgcolor="#FFFFFF">
<!-- THIS FILE HAS BEEN AUTOMATICALLY PROCESSED FROM A SOURCE COPY -->
<!-- DO NOT EDIT MANUALLY !!! -->
<table class="Banner" cellspacing="0" cellpadding="0" border="1" bordercolorlight="#303080" bordercolordark="#7070B0">
<tr>
<td class="Banner" nowrap=""><a href="../../../../../_Body.htm" class="Banner"><img src="../../../../../../Images/_Home.gif" align="absmiddle">Home</a>
</td>
<td class="Banner" nowrap=""><a href="../../../_Body.htm" class="Banner"><img src="../../../../../../Images/_Unit.gif" align="absmiddle">ClipperLib</a>
</td>
<td class="Banner" nowrap=""><a href="../_Body.htm" class="Banner"><img src="../../../../../../Images/_Class.gif" align="absmiddle">ClipperOffset</a>
</td>
<td class="Banner" width="100%" align="right"><img src="../../../../../../Images/_Project_Logo.gif" align="absmiddle">
</td>
</tr>
</table>
<h1>ClipperOffset.ArcTolerance</h1>
<p class="Decl"><span class="Comment">Del.»</span> <b>property</b> ArcTolerance: double; <span class="Comment">//read and write</span></p>
<p class="Decl2"><span class="Comment"> C++ »</span> <b>double</b> ArcTolerance;</p>
<p class="Decl3"><span class="Comment">C# »</span> <b>public double</b> ArcTolerance {get; set;}</p>
<br>
<p class="Body"> Firstly, this field/property is only relevant when JoinType = jtRound and/or EndType = etRound.<br><br> Since flattened paths can never perfectly represent arcs, this field/property specifies a maximum acceptable imprecision ('tolerance') when arcs are approximated in an offsetting operation. Smaller values will increase 'smoothness' up to a point though at a cost of performance and in creating more vertices to construct the arc.<br><br> The default ArcTolerance is 0.25 units. This means that the maximum distance the flattened path will deviate from the 'true' arc will be no more than 0.25 units (before rounding).<br><br> <span class="maroon">Reducing tolerances below 0.25 will <b>not</b> improve smoothness since vertex coordinates will still be rounded to integer values.</span> The only way to achieve sub-integer precision is through coordinate scaling before and after offsetting (see example below).<br><br> <span class="maroon">It's important to make ArcTolerance a sensible fraction of the offset delta (arc radius)</span>. Large tolerances relative to the offset delta will produce poor arc approximations but, just as importantly, very small tolerances will substantially slow offsetting performance while providing unnecessary degrees of precision. This is most likely to be an issue when offsetting polygons whose coordinates have been scaled to preserve floating point precision.<br><br> <b>Example:</b> Imagine a set of polygons (defined in floating point coordinates) that is to be offset by 10 units using <em>round</em> joins, and the solution is to retain floating point precision up to at least 6 decimal places.<br> To preserve this degree of floating point precision, and given that Clipper and ClipperOffset both operate on integer coordinates, the polygon coordinates will be scaled up by 10<sup>8
</sup> (and rounded to integers) prior to offsetting. Both offset delta and ArcTolerance will also need to be scaled by this same factor. <em>If ArcTolerance was left unscaled at the default 0.25 units, every arc in the solution would contain a fraction of 44 THOUSAND vertices</em> while the final arc imprecision would be 0.25 × 10<sup>-8
</sup> units (ie once scaling was reversed). However, if 0.1 units was an acceptable imprecision in the final <em>unscaled</em> solution, then ArcTolerance should be set to 0.1 × scaling_factor (0.1 × 10<sup>8
</sup>). Now if scaling is applied equally to both ArcTolerance and to Delta Offset, then in this example the number of vertices (steps) defining each arc would be a fraction of 23.<br><br> The <a href="../../../../../../offset_triginometry2.svg">formula</a> for the number of steps in a full circular arc is ... Pi / acos(1 - arc_tolerance / abs(delta)) </p>
<h2 id="Auto-SeeAlso">See Also</h2>
<p class="Body"><a href="../../../../../../offset_triginometry2.svg">offset_triginometry2</a></p>
<p class="Copyright" id="auto"> <br><br> Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014 <br><br> </p>
</body>
</html>
|