Scale by millimeters, centimeters, or inches


Drawing and rendering, as per the NodeBox API, can be conceptualized in millimeters, centimeters, or inches.


1. Scale by millimeters.


(

n = NB(

"points2millimeters", 

"120 * mm", 

"80 * mm"

);

n.rect(10, 10, 100, 100);

n.print(\WIDTH);

n.print(\HEIGHT);

n.displayCode

// And then command-r in NodeBox to render

)


/* ----- ----- ----- ----- */

/* ----- ----- ----- ----- */


2. Scale by centimeters.


(

n = NB(

"points2centimeters", 

"12 * cm", 

"8 * cm"

);

n.rect(10, 10, 100, 100);

n.print(\WIDTH);

n.print(\HEIGHT);

n.displayCode

// Command-r in NodeBox to render

)


/* ----- ----- ----- ----- */

/* ----- ----- ----- ----- */


3. Scale by inches.


(

n = NB(

"points2inches", 

"4.72440945 * inch", 

"3.1496063 * inch"

);

n.rect(10, 10, 100, 100);

n.print(\WIDTH);

n.print(\HEIGHT);

n.displayCode

// Command-r in NodeBox to render

)