# Julia and Projective Geometric Algebra with GLMakie: Unable to Plot 3D Triangle

**URL:** <https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [April 8, 2023, 6:02am UTC](https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244 "2023-04-08T06:02:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [April 8, 2023, 6:02am UTC](https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244/1 "2023-04-08T06:02:49Z")

</div>

Hi all,

I am following this medium:

> **[Julia and Projective Geometric Algebra](https://olarth.medium.com/julia-and-projective-geometric-algebra-e2d5abb11519)**
>
> experience the geometry superpowers of PGA

and I am trying the code to plot 3D Triangle from REPL:

```julia
#=
  1. includes “ripga3d.jl” so the REPL can evaluate 3D PGA expressions,
  2. defines three vertices of a triangle in 3D space,
  3. translates the vertices from Euclidean coordinates to PGA expressions,
  4. constructs three triangle sides by joining pairs of those vertices,
  5. calculates the lengths of the triangle sides,
  6. constructs a plane face by joining all three vertices,
  7. calculates the area of the triangle,
  8. defines a horizontal plane at z=1/2,
  9. cuts the triangle with that horizontal plane, and finally
  10. plots the cut triangle.
=#
include("ripga3d.jl"); # REPL G
using GLMakie

VC = Float32.([0 -1/2 1/2; 0 -1 -1; 1 0 0]) # Vertex Coordinates
V = point(VC) # Vertex PGA expressions
S = [V[:,1]&V[:,2] V[:,2]&V[:,3] V[:,3]&V[:,1]] # triangle Sides
side_lengths = norm(S)
F = V[:,1] & V[:,2] & V[:,3]
area = norm(F)/2
zcut = e3 - 0.5*e0
P = S ^ zcut
C = toCoord(P)

fig = Figure()
ax3d = Axis3(fig[1,1], aspect = (1,1,1));
lines!(ax3d, [VE VE[:,1]], color = :black);
scatter!(ax3d, VE, markersize = 25, color = [:red, :green, :blue]);
lines!(ax3d, C, linestyle = :dot, color = :gray);

```

I got an error:

**LoadError: UndefVarError: VE not defined**  
**Stacktrace:**

What did I miss?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [April 8, 2023, 8:41am UTC](https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244/2 "2023-04-08T08:41:25Z")

</div>

I couldn’t see any definition for `VE` in the original article, so - unless some version of your existing `V` or `VC` works - you’ll have to ask the author…
