Published
Edited
Jul 17, 2021
3 forks
4 stars
Insert cell
# 3D Projective Geometry starter page
## PGA3D -- taken from ganja.js/examples/example_pga3d_points_and_lines.html

Code is broken up in three parts -
- initialization (bottom of page)
- display plot (adjacent below
- scene definition (below plot)
- referance of PGA3d follows
Insert cell
Insert cell
## Plot Definition

Insert cell
Insert cell
Insert cell
Insert cell
Algebra = require("ganja.js")
Insert cell
Algebra(3,0,1,()=>{
var gridX = Array.apply([],{length:21}).map((x,i)=>[1e123+2e012+1e013+(i-10)*.2e023,1e123-2e012+1e013+(i-10)*.2e023]);
var gridY = Array.apply([],{length:21}).map((x,i)=>[1e123+2e023+1e013+(i-10)*.2e012,1e123-2e023+1e013+(i-10)*.2e012]);
var orig = 1e123-1e013;
debugger;
//var p = Algebra.Point(1,1);
var p2 = 1e123+1e013-1.35e023+.8e012;
var p3 = 1e123+1e013+1.35e023+1.1e012;
//var p4 = p.slice();
var camera=1+0e0, t=0;
debugger;
console.log('line : ',(orig&p2&p3)^(p2&p3));
var el=this.graph(()=>{
t = t+ 0.001;
camera.set(Math.cos(t)+Math.sin(t)*1e13);
return [orig,"origin in 3D",0x123456,gridX,"gridx",gridY,"GRIDY",0x4444cc, p2,"point in 2D",orig&p2,"vector in 3D",0xffcccc,[orig,p2,p3],0xCC4444,"bivector in 3D",p2&p3,"line in 2D"]},{gl:true, animate:true, camera}); //
el.style.width='100%',el.style.height='500px'; return el;
})
Insert cell
Insert cell
notTheThumb=true
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more