Skip to content

Commit

Permalink
Merge pull request #72 from eric-wieser/fix-cga2d-renderer
Browse files Browse the repository at this point in the history
Fixups to previous PR
  • Loading branch information
enkimute authored Jan 30, 2020
2 parents 412aea1 + 8696f9c commit e0f0d9e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ganja.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,16 +647,16 @@
if (typeof o =='number') { color='#'+(o+(1<<25)).toString(16).slice(-6); return ''; };
// All other elements are rendered ..
var einf_part = o.Dot(cga2d_no.Scale(-1)); // O_i + n_o O_oi
var eo_part = cga2d_ni.Scale(-1).Dot(o); // O_o + O_oi n_i
if (einf_part.s * 1e-9 > eo_part.s) {
var eo_part = cga2d_ni.Scale(-1).Dot(o); // O_o + O_oi n_i
if (einf_part.VLength * 1e-6 > eo_part.VLength) {
// direction or dual - nothing to render
return "";
}
var eo_einf_part = eo_part.Dot(cga2d_no.Scale(-1)); // O_oi
var eo_only_part = cga2d_ni.Wedge(eo_part).Dot(cga2d_no.Scale(-1)); // O_o
/* Note: making 1e-6 smaller increases the maximum circle radius before they are drawn as lines */
if (eo_einf_part.Length * 1e-6 > eo_only_part.Length) {
if (eo_einf_part.VLength * 1e-6 > eo_only_part.VLength) {
var is_flat = true;
var direction = eo_einf_part;
}
Expand All @@ -672,6 +672,7 @@
var b0=direction.Grade(0).VLength>0.001,b1=direction.Grade(1).VLength>0.001,b2=direction.Grade(2).VLength>0.001;
if (!is_flat && b0 && !b1 && !b2) {
// Points
if (direction.s < 0) { o = Element.Sub(o); }
lx=sc*(o.e1); ly=sc*(-o.e2); lr=0; return res2=`<CIRCLE onmousedown="this.parentElement.sel=${oidx}" cx="${lx}" cy="${ly}" r="${pointRadius*0.03}" fill="${color||'green'}"/>`;
} else if (is_flat && !b0 && b1 && !b2) {
// Lines.
Expand Down

0 comments on commit e0f0d9e

Please sign in to comment.