From f4b5d7eed8c38ef70aec864d78f084a3d22ddd05 Mon Sep 17 00:00:00 2001
From: ehennes <[EMAIL PROTECTED]>
Date: Sun, 12 Oct 2008 09:41:38 -0700
Subject: [PATCH] Fixed various issues with the object hatching functions.

Fixed integer overflow when hatching circles with a large radius.
Fixed hatch angle of boxes and polygons to match older algorithm.
Fixed hatch lines exactly intersecting vertex may not be generated properly.
---
 libgeda/src/m_hatch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgeda/src/m_hatch.c b/libgeda/src/m_hatch.c
index 26dc3a6..f626b3d 100644
--- a/libgeda/src/m_hatch.c
+++ b/libgeda/src/m_hatch.c
@@ -157,7 +157,7 @@ void m_hatch_circle(CIRCLE *circle, gint angle, gint pitch, 
GArray *lines)
 
   while ( sweep_y < radius ) {
     LINE line;
-    gint x = round(sqrt(radius*radius - sweep_y*sweep_y));
+    gint x = round(sqrt(pow(radius,2) - pow(sweep_y,2)));
 
     line.x[0] = -x;
     line.y[0] = sweep_y;
@@ -205,7 +205,7 @@ void m_hatch_polygon(GArray *points, gint angle, gint 
pitch, GArray *lines)
 
   m_transform_init(&transform);
   m_transform_scale(&transform, 10);
-  m_transform_rotate(&transform, angle);
+  m_transform_rotate(&transform, -angle);
   m_transform_invert(&transform, &inverse);
 
   g_array_append_vals(points2, points->data, points->len);
@@ -256,7 +256,7 @@ void m_hatch_polygon(GArray *points, gint angle, gint 
pitch, GArray *lines)
     /* remove status no longer intersecting sweep line */
     index = status->len;
     while ( index-- > 0 ) {
-      if ( sweep_y > g_array_index(status, SWEEP_STATUS, index).y1 ) {
+      if ( sweep_y >= g_array_index(status, SWEEP_STATUS, index).y1 ) {
         g_array_remove_index_fast(status, index);
       }
     }
-- 
1.5.4.3




_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to