@@ -372,17 +372,32 @@ public static IEnumerable<Line> CreateGrid(GridType gridType, double width, doub
372372
373373 return lines ;
374374 }
375- ////case GridType.OneDotFiveRectangle:
376- //// {
377- //// var rectangle = CalculateDynamicRectangleExtents(1.5 / RatioConstants.One, actualAspectRatio);
378- //// var lines = CreateRootNRectangle(rectangle);
379- //// // TODO: armature
380- //// return lines;
381- //// }
375+ case GridType . OneDotFiveRectangle :
376+ {
377+ var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . OneDotFive , actualAspectRatio ) ;
378+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
379+
380+ var w = rectangle . Width / ( RatioConstants . OneDotFive * RatioConstants . OneDotFive ) ;
381+ var h = rectangle . Height / ( RatioConstants . OneDotFive * RatioConstants . OneDotFive ) ;
382+ lines . Add ( new Line ( rectangle . Left + w , rectangle . Top , rectangle . Left + w , rectangle . Bottom ) ) ;
383+ lines . Add ( new Line ( rectangle . Right - w , rectangle . Top , rectangle . Right - w , rectangle . Bottom ) ) ;
384+ lines . Add ( new Line ( rectangle . Left , rectangle . Top + h , rectangle . Right , rectangle . Top + h ) ) ;
385+ lines . Add ( new Line ( rectangle . Left , rectangle . Bottom - h , rectangle . Right , rectangle . Bottom - h ) ) ;
386+
387+ // Left
388+ lines . Add ( new Line ( rectangle . Left , rectangle . Top , rectangle . Left + w , rectangle . Bottom ) ) ;
389+ lines . Add ( new Line ( rectangle . Left , rectangle . Bottom , rectangle . Left + w , rectangle . Top ) ) ;
390+
391+ // Right
392+ lines . Add ( new Line ( rectangle . Right , rectangle . Top , rectangle . Right - w , rectangle . Bottom ) ) ;
393+ lines . Add ( new Line ( rectangle . Right , rectangle . Bottom , rectangle . Right - w , rectangle . Top ) ) ;
394+
395+ return lines ;
396+ }
382397 case GridType . GoldenRectangle :
383398 {
384399 var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . Phi / RatioConstants . One , actualAspectRatio ) ;
385- var lines = CreateRootNRectangle ( rectangle ) ;
400+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
386401
387402 var w = rectangle . Width * RatioConstants . Phi3D8 ;
388403 var h = rectangle . Height * RatioConstants . Phi3D8 ;
@@ -409,7 +424,7 @@ public static IEnumerable<Line> CreateGrid(GridType gridType, double width, doub
409424 case GridType . Root2Rectangle :
410425 {
411426 var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . Root2 / RatioConstants . One , actualAspectRatio ) ;
412- var lines = CreateRootNRectangle ( rectangle ) ;
427+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
413428 lines . Add ( new Line ( rectangle . Left , RatioConstants . Half , rectangle . Right , RatioConstants . Half ) ) ;
414429 lines . Add ( new Line ( RatioConstants . Half , rectangle . Top , RatioConstants . Half , rectangle . Bottom ) ) ;
415430 lines . Add ( new Line ( rectangle . Left , rectangle . Bottom , RatioConstants . Half , rectangle . Top ) ) ;
@@ -421,7 +436,7 @@ public static IEnumerable<Line> CreateGrid(GridType gridType, double width, doub
421436 case GridType . Root3Rectangle :
422437 {
423438 var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . Root3 / RatioConstants . One , actualAspectRatio ) ;
424- var lines = CreateRootNRectangle ( rectangle ) ;
439+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
425440 lines . AddRange ( CreateRegularLines ( rectangle , 2 ) ) ;
426441 var w = rectangle . Width / 3.0 ;
427442 // Left
@@ -433,13 +448,13 @@ public static IEnumerable<Line> CreateGrid(GridType gridType, double width, doub
433448 // Two horizontals
434449 var h = rectangle . Height / 3.0 ;
435450 lines . Add ( new Line ( rectangle . Left , rectangle . Top + h , rectangle . Right , rectangle . Top + h ) ) ;
436- lines . Add ( new Line ( rectangle . Left , rectangle . Bottom - h , rectangle . Right , rectangle . Bottom - h ) ) ;
451+ lines . Add ( new Line ( rectangle . Left , rectangle . Bottom - h , rectangle . Right , rectangle . Bottom - h ) ) ;
437452 return lines ;
438453 }
439454 case GridType . Root4Rectangle :
440455 {
441456 var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . Root4 / RatioConstants . One , actualAspectRatio ) ;
442- var lines = CreateRootNRectangle ( rectangle ) ;
457+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
443458 lines . AddRange ( CreateRegularLines ( rectangle , 3 ) ) ;
444459 var w = rectangle . Width / 4.0 ;
445460 // Left
@@ -456,14 +471,14 @@ public static IEnumerable<Line> CreateGrid(GridType gridType, double width, doub
456471 // Two horizontals
457472 var h = rectangle . Height / 4.0 ;
458473 lines . Add ( new Line ( rectangle . Left , rectangle . Top + h , rectangle . Right , rectangle . Top + h ) ) ;
459- lines . Add ( new Line ( rectangle . Left , rectangle . Bottom - h , rectangle . Right , rectangle . Bottom - h ) ) ;
474+ lines . Add ( new Line ( rectangle . Left , rectangle . Bottom - h , rectangle . Right , rectangle . Bottom - h ) ) ;
460475
461476 return lines ;
462477 }
463478 case GridType . Root5Rectangle :
464479 {
465480 var rectangle = CalculateDynamicRectangleExtents ( RatioConstants . Root5 / RatioConstants . One , actualAspectRatio ) ;
466- var lines = CreateRootNRectangle ( rectangle ) ;
481+ var lines = CreateRectangleWithMainDiagonals ( rectangle ) ;
467482 lines . AddRange ( CreateRegularLines ( rectangle , 4 ) ) ;
468483 var w = rectangle . Width / 5.0 ;
469484 // Left
@@ -515,7 +530,7 @@ private static Rectangle CalculateDynamicRectangleExtents(double desiredAspectRa
515530 return new Rectangle { X = left , Y = top , Width = right - left , Height = bottom - top } ;
516531 }
517532
518- private static List < Line > CreateRootNRectangle ( Rectangle rectangle )
533+ private static List < Line > CreateRectangleWithMainDiagonals ( Rectangle rectangle )
519534 {
520535 double left , right , top , bottom ;
521536 left = rectangle . Left ;
@@ -525,12 +540,13 @@ private static List<Line> CreateRootNRectangle(Rectangle rectangle)
525540
526541 var lines = new List < Line > ( ) ;
527542
543+ // Four contour lines
528544 lines . Add ( new Line ( left , top , left , bottom ) ) ;
529545 lines . Add ( new Line ( right , top , right , bottom ) ) ;
530546 lines . Add ( new Line ( left , top , right , top ) ) ;
531547 lines . Add ( new Line ( left , bottom , right , bottom ) ) ;
532548
533- // Main diagonals
549+ // Two main diagonals
534550 lines . Add ( new Line ( left , top , right , bottom ) ) ;
535551 lines . Add ( new Line ( left , bottom , right , top ) ) ;
536552
0 commit comments