diff --git a/README.md b/README.md
index 0e945d4..90017d3 100644
--- a/README.md
+++ b/README.md
@@ -306,8 +306,8 @@ PGA2D Desargues Theorem
CGA2D Euler Line
-CGA2D Basics
-
+CGA2D Points and Circles
+
ganja.js is also the engine behind the GAlculator - try it [online](https://enkimute.github.io/ganja.js/examples/galculator.html) or get it on the [play store](https://play.google.com/store/apps/details?id=io.github.enkimute)
diff --git a/images/cga2d_basics.jpg b/cga2d_points_and_circles.jpg
similarity index 100%
rename from images/cga2d_basics.jpg
rename to cga2d_points_and_circles.jpg
diff --git a/examples/coffeeshop.html b/examples/coffeeshop.html
index 2854d51..f2439f6 100644
--- a/examples/coffeeshop.html
+++ b/examples/coffeeshop.html
@@ -80,7 +80,7 @@ The Coffeeshop
"timespace_lorentz",
"pga2d_points_and_lines","pga2d_distances_and_angles","pga2d_project_and_reject","pga2d_rotors_and_translators","pga2d_isometries", "pga2d_inverse_kinematics","pga2d_separating_axis","pga2d_pose_estimation","pga2d_euler_line","pga2d_desargues_theorem","pga2d_differentiation",
"pga3d_points_and_lines","pga3d_distances_and_angles","pga3d_rotors_and_translators","pga3d_icosahedron","pga3d_sampling","pga3d_slicing","pga3d_differentiation","pga3d_skinning",
- "cga2d_basics","cga2d_rotors_and_translators","cga2d_euler_line",
+ "cga2d_points_and_circles","cga2d_project_and_reject","cga2d_rotors_and_translators","cga2d_euler_line",
"game_wedge"];
var $ = document.getElementById.bind(document);
diff --git a/examples/example_cga2d_basics.html b/examples/example_cga2d_basics.html
index 46b33bb..6d7eaff 100644
--- a/examples/example_cga2d_basics.html
+++ b/examples/example_cga2d_basics.html
@@ -27,9 +27,17 @@
var translate = (v)=>(1-.5*v^ei),
rotate = (P,a)=>Math.cos(a/2) + Math.sin(a/2)*(1e12+1e12<X<<(P^ei)*(P^ei),
+ project_point_on_circle = (P,C)=>C<<(P^ei)*C,
+ position = (C)=>C/(C^ei),
+ radius = (C)=>(C*~C).s/((C<(ei^(C<(1+attitude(PP)*radius(PP)*.5)>>>(PP/(PP<X&C, pp2=()=>C&D, pp3=()=>Y&D;
-// Distances and angles between all items.
- var dp1 = ()=>dist(D,p1).toFixed(2),
+// Distances and angles.
+ var dp1 = ()=>( (p1-split(project_point_on_circle(p1,D).Normalized)).Length ).toFixed(2),
beta = ()=>angle(X,Y).toFixed(2);
+
+ var round = (X)=>{ while(X.call) X=X();
+ var nix = X^ei,
+ r = ((X<0.00001 && r) return pos+r*attitude; //[pos+attitude,pos-attitude];
+ return pos;
+ }
+
+ //gav(D);
+ //gav(pp1);
+
// Graph these items.
document.body.appendChild(this.graph([
"2D CGA - drag p1,p2,p3","", // title
()=>"|D,p1|="+dp1, // distance
()=>"β = "+beta, // distance
- 0xFF8888, C, "C", D, "D", // circles
+ 0xFF8888, C, D, "D", // circles
0x44AA44, X, "X", Y, "Y", // lines
0x4444FF, pp1, "pp1", pp2, pp3, // point pairs
+ 0x448844,
+ ()=>position(C), ()=>"C "+(Math.sqrt(-radius(C)).toFixed(2)),
+ ()=>position(D), ()=>"D "+(Math.sqrt(-radius(D)).toFixed(2)),
+ ()=>line_through_P_parallel_with_X(p1,D),"parallel to D",
+ ()=>line_through_P_parallel_with_X(split(project_point_on_circle(p1,D).Normalized),D),"parallel to D",
+ ()=>ei^p1^split(project_point_on_circle(p1,D).Normalized), "p1 on D",
+ ()=>split(project_point_on_circle(p1,D).Normalized), "p1 on D",
+ ()=>split(-project_point_on_circle(p1,C).Normalized), "p1 on C",
0x666666, p1, "p1", p2, "p2", p3, "p3", // points
+ 0xFF0000, ()=>round(pp1),
+ 0xFF0000, ()=>round(C),
+ 0xFF0000, ()=>round(p1),
],{conformal:true})); // conformal flag!
});
diff --git a/examples/example_cga2d_points_and_circles.html b/examples/example_cga2d_points_and_circles.html
new file mode 100644
index 0000000..00f9907
--- /dev/null
+++ b/examples/example_cga2d_points_and_circles.html
@@ -0,0 +1,51 @@
+
+
+
+
\ No newline at end of file
diff --git a/examples/example_cga2d_project_and_reject.html b/examples/example_cga2d_project_and_reject.html
new file mode 100644
index 0000000..0830d0f
--- /dev/null
+++ b/examples/example_cga2d_project_and_reject.html
@@ -0,0 +1,48 @@
+
+
+
+
\ No newline at end of file
diff --git a/examples/example_cga2d_rotors_and_translators.html b/examples/example_cga2d_rotors_and_translators.html
index 9c97f66..93bb647 100644
--- a/examples/example_cga2d_rotors_and_translators.html
+++ b/examples/example_cga2d_rotors_and_translators.html
@@ -12,7 +12,7 @@
// Rotator, Translator
var translate = (v)=>(1-.5*v^ei),
- rotate = (P,a)=>Math.cos(a/2) + Math.sin(a/2)*(1e12+1e12<Math.cos(a/2) - Math.sin(a/2)*(1e12+1e12< translate( Math.sin(performance.now()/1000)*1e1 ),
@@ -22,7 +22,10 @@
// Graph these items.
document.body.appendChild(this.graph([
- p1,"tr>>>p1",p2,"rt>>>p2",()=>[p1,p2]
+ p1,"tr>>>p1", // point 1
+ p2,"rt>>>p2", // point 2
+ ()=>[p1,p2], // segment from 1 to 2
+ ()=>p1^p2^point(0,2,0) // pretty circle
],{conformal:true,animate:true}));
});
|