• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

修訂c7da45a37c6fbccf93e79e28753030527f21d6e6 (tree)
時間2014-06-08 17:58:07
作者Hans Breuer <hans@breu...>
CommiterHans Breuer

Log Message

Prepare DiaRenderer::draw_arc() to be refined

- some comments to make the following change more easy
- arc-definition.dia: sketching the current and future behavior
- arcs.dia: dedicated test file for current arc usages

Change Summary

差異

--- a/lib/diasvgrenderer.c
+++ b/lib/diasvgrenderer.c
@@ -529,8 +529,8 @@ draw_arc(DiaRenderer *self,
529529 real sy=center->y - ry*sin(angle1*G_PI/180);
530530 real ex=center->x + rx*cos(angle2*G_PI/180);
531531 real ey=center->y - ry*sin(angle2*G_PI/180);
532- int swp = 0; /* always drawin negative direction */
533- int large_arc;
532+ int swp = 0; /* always drawing negative direction (still) */
533+ int large_arc;
534534 gchar sx_buf[DTOSTR_BUF_SIZE];
535535 gchar sy_buf[DTOSTR_BUF_SIZE];
536536 gchar rx_buf[DTOSTR_BUF_SIZE];
--- a/lib/geometry.c
+++ b/lib/geometry.c
@@ -582,7 +582,7 @@ fillet(Point *p1, Point *p2, Point *p3, Point *p4,
582582 /* also this means we need to swap our angles later on */
583583 righthand = TRUE;
584584 }
585- /* now calculate the actual angles in a form that the draw arc function
585+ /* now calculate the actual angles in a form that the draw_arc function
586586 of the renderer can use */
587587 start_angle = start_angle*180.0/G_PI;
588588 stop_angle = start_angle + stop_angle*180.0/G_PI;
--- a/objects/standard/arc.c
+++ b/objects/standard/arc.c
@@ -798,7 +798,7 @@ arc_update_data(Arc *arc)
798798 y1 = endpoints[0].y;
799799 x2 = endpoints[1].x;
800800 y2 = endpoints[1].y;
801-
801+
802802 lensq = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
803803 if (fabs(arc->curve_distance) > 0.01)
804804 radius = lensq/(8*arc->curve_distance) + arc->curve_distance/2.0;
@@ -820,6 +820,7 @@ arc_update_data(Arc *arc)
820820 if (angle2<0)
821821 angle2+=360.0;
822822
823+ /* swap: draw_arc is always counter-clockwise */
823824 if (radius<0.0) {
824825 real tmp;
825826 tmp = angle1;
@@ -843,6 +844,10 @@ arc_update_data(Arc *arc)
843844 arc_update_handles(arc);
844845 /* startpoint, midpoint, endpoint */
845846 righthand = is_right_hand (&endpoints[0], &arc->middle_handle.pos, &endpoints[1]);
847+ /* there should be no need to calculate the direction once more */
848+ if (!( (righthand && arc->curve_distance <= 0.0)
849+ || (!righthand && arc->curve_distance >= 0.0)))
850+ g_warning ("Standard - Arc: check invariant!");
846851 connection_update_boundingbox(conn);
847852
848853 /* fix boundingbox for arc's special shape XXX find a more elegant way: */
@@ -867,8 +872,9 @@ arc_update_data(Arc *arc)
867872 rectangle_add_point (&obj->bounding_box, &pt);
868873 }
869874 if (arc->start_arrow.type != ARROW_NONE) {
870- /* a good from-point would be the chord of arrow length, but draw_arc_with_arrows currently uses the tangent
871- * For big arcs the difference is not huge and the minimum size of small arcs should be limited by the arror length.
875+ /* a good from-point would be the chord of arrow length, but draw_arc_with_arrows
876+ * currently uses the tangent For big arcs the difference is not huge and the
877+ * minimum size of small arcs should be limited by the arror length.
872878 */
873879 Rectangle bbox = {0,};
874880 real tmp;
Binary files /dev/null and b/samples/Self/arc-definition.dia differ
Binary files /dev/null and b/samples/arcs.dia differ