# HG changeset patch # User Etienne Grossmann # Date 1446094825 25200 # Wed Oct 28 22:00:25 2015 -0700 # Node ID 68a0b0a6e06eb2fa36632ca6bd888d2866d5f75b # Parent 226e9c81eb04fe18fb3c4fd85207c8c64dfb9e04 Hey, there's just one changed file wrt hg diff -r 226e9c81eb04 -r 68a0b0a6e06e inst/checker_color.m --- a/inst/checker_color.m Tue Sep 03 07:50:42 2013 -0400 +++ b/inst/checker_color.m Wed Oct 28 22:00:25 2015 -0700 @@ -13,10 +13,30 @@ ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . -## col = checker_color (R,C, checker, col) +## col = checker_color (checker, colors, R,C) - Checkered colors for a RxC-vertex surface +## +## Returns checkered colors for each of the (R-1) x (C-1) facets of a RxC-vertex surface. +## +## checker : 1 x 2 : If positive: number of squares in checkerboard +## If negative: number of facets in each checkerboard square +## +## colors : can be +## 3 x 2 : The two colors of the checkerboard +## 1 x 2 : The two intensities of the checkerboard (colors are grey) +## 3 x 1 : The color of non-black squares of the checkerboard (or non-white, if +## colors(:) all 0). +## +## R, C : Number of nodes +## +## col : 3 x (R-1)*(C-1) function col = checker_color (checker, col, R,C) +if nargin != 4 + help checker_color + error("Wrong arguments"); +endif + if length (checker) == 1, checker = [checker, checker]; end if checker(1) > 0, checker(1) = - (C-1)/checker(1); end @@ -30,7 +50,7 @@ # Keep at most 1st 2 colors of col for the # checker if prod (size (col)) == 2, - col = [1;1;1]*col; + col = [1;1;1]*col(:)'; elseif prod (size (col)) < 6, # Can't be < 3 because of previous code col = col(1:3)(:); if all (col >= 1-eps), col = [col [0;0;0]]; # Black and White