Skip to content

Commit

Permalink
Defined a transform function for determining the time sign of spin-ve…
Browse files Browse the repository at this point in the history
…ctors after multiplication.
  • Loading branch information
iamazadi committed Oct 31, 2024
1 parent 4aa5b0d commit affc62a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
35 changes: 24 additions & 11 deletions src/spacetime/fig113diracsscissors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sphereobservable = buildsurface(lscene, spherematrix, mask, transparency = true)
planematrix = makestereographicprojectionplane(M, T = T, segments = segments)
planeobservable = buildsurface(lscene, planematrix, mask, transparency = true)
ϵ = 0.1
transformation = SpinTransformation(ϵ + rand() * 0.1, ϵ + rand() * 0.1, ϵ + rand() * 0.1)
transformation = SpinTransformation(rand() * ϵ, rand() * ϵ, rand() * ϵ)

generate() = 2rand() - 1 + im * (2rand() - 1)
κ = SpinVector(generate(), generate(), Int(T))
Expand Down Expand Up @@ -99,9 +99,9 @@ GLMakie.text!(lscene,
markerspace = :data
)

κflagplanematrix = makeflagplane(κv, κ′v - κv, segments = segments)
κflagplanematrix = makeflagplane(κv, κ′v - κv, T, segments = segments)
κflagplanecolor = GLMakie.Observable(fill(GLMakie.RGBAf(0.5, 0.5, 0.5, 0.5), segments, segments))
κflagplaneobservable = buildsurface(lscene, κflagplanematrix, κflagplanecolor, transparency = false)
κflagplaneobservable = buildsurface(lscene, κflagplanematrix, κflagplanecolor, transparency = true)

κsectional = GLMakie.Observable(GLMakie.Point3f(projectnocompression(normalize((vec(κv))))))
κ′sectional = GLMakie.Observable(GLMakie.Point3f(projectnocompression(normalize((vec(κ′v))))))
Expand Down Expand Up @@ -142,16 +142,29 @@ animate(frame::Int) = begin
ϕ = 0.0
ψ = 0.0
spintransform = SpinTransformation(θ, ϕ, ψ)
transform(κ, spintransform) = begin
vector = mat(spintransform) * vec(κ)
timesign = κ.timesign
result = SpinVector(convert(Vector{Complex}, vector)..., timesign)
if isapprox(result, -κ)
timesign = -κ.timesign
result = SpinVector(convert(Vector{Complex}, vector)..., timesign)
end
return result
end
κtransformed = 𝕍(transform(κ, spintransform))
κ′transformed = 𝕍(transform(κ′, spintransform))
κ″transformed = 𝕍(transform(κ″, spintransform))
T = Float64(transform(κ, spintransform).timesign)
println("T: $T")
northpole[] = GLMakie.Point3f(ℝ³(0.0, 0.0, T))
spherematrix = makesphere(spintransform, T, segments = segments)
planematrix = makestereographicprojectionplane(spintransform, T = 1.0, segments = segments)
planematrix = makestereographicprojectionplane(spintransform, T = T, segments = segments)
updatesurface!(planematrix, planeobservable)
updatesurface!(spherematrix, sphereobservable)
κtransformed = 𝕍(spintransform * κ)
κ′transformed = 𝕍(spintransform * κ′)
κ″transformed = 𝕍(spintransform * κ″)
κflagplanematrix = makeflagplane(κtransformed, 𝕍(LinearAlgebra.normalize(vec(κ′transformed - κtransformed))), segments = segments)
κflagplanematrix = makeflagplane(κtransformed, 𝕍(LinearAlgebra.normalize(vec(κ′transformed - κtransformed))), T, segments = segments)
updatesurface!(κflagplanematrix, κflagplaneobservable)
κflagplanecolor[] = [GLMakie.RGBAf(convert_hsvtorgb([360.0 * progress; 1.0; 1.0])..., 1.0) for i in 1:segments, j in 1:segments]
κflagplanecolor[] = [GLMakie.RGBAf(convert_hsvtorgb([360.0 * progress; 1.0; 1.0])..., 0.8) for i in 1:segments, j in 1:segments]
κobservable[] = GLMakie.Point3f(projectnocompression(normalize((vec(κtransformed)))))
κ′observable[] = GLMakie.Point3f(projectnocompression(normalize((vec(κ′transformed)))))
κ″observable[] = GLMakie.Point3f(projectnocompression(normalize((vec(κ″transformed)))))
Expand All @@ -161,10 +174,10 @@ animate(frame::Int) = begin
κsectional[] = (κobservable[] + κprojectionobservable[]) * 0.5
κ′sectional[] = (κ′observable[] + κ′projectionobservable[]) * 0.5
κ″sectional[] = (κ″observable[] + κ″projectionobservable[]) * 0.5
for (i, scale1) in enumerate(collect(range(0.0, stop = 1.0, length = segments)))
for (i, scale1) in enumerate(collect(range(0.0, stop = T, length = segments)))
_κlinepoints = GLMakie.Point3f[]
_κlinecolors = Int[]
for (j, scale2) in enumerate(collect(range(0.0, stop = 1.0, length = segments)))
for (j, scale2) in enumerate(collect(range(0.0, stop = T, length = segments)))
κvector = normalize((vec(scale1 * κtransformed + scale2 * 𝕍(LinearAlgebra.normalize(vec(κ′transformed - κtransformed))))))
κpoint = GLMakie.Point3f(projectnocompression(κvector))
push!(_κlinepoints, κpoint)
Expand Down
16 changes: 6 additions & 10 deletions src/spacetime/spintransformation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,12 @@ det(a::SpinTransformation) = real(a.α * a.δ - a.β * a.γ)


*(a::SpinTransformation, b::SpinVector) = begin
# if isapprox(b.a[2], Complex(0))
# SpinVector(a.α * b.a[1] + a.β * b.a[2], a.γ * b.a[1] + a.δ * b.a[2], b.timesign)
# else
# ζ = b.a[1] / b.a[2]
# SpinVector((a.α * ζ + a.β) / (a.γ * ζ + a.δ), b.timesign)
# end
vector = mat(a) * vec(b)
ξ, η = vector
timesign = sign(real* conj(ξ) + η * conj(η))) > 0 ? 1 : -1
SpinVector(vector..., timesign)
if isapprox(b.a[2], Complex(0))
SpinVector(a.α * b.a[1] + a.β * b.a[2], a.γ * b.a[1] + a.δ * b.a[2], b.timesign)
else
ζ = b.a[1] / b.a[2]
SpinVector((a.α * ζ + a.β) / (a.γ * ζ + a.δ), b.timesign)
end
end


Expand Down
6 changes: 6 additions & 0 deletions src/spacetime/spinvector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ end
t = float.timesign)
v = ℝ³(κ)
𝕍(ℝ⁴(t, vec(t * v)...))
# ξ, η = vec(κ)
# T = (1 / √2) * (ξ * conj(ξ) + η * conj(η))
# X = (1 / √2) * (ξ * conj(η) + η * conj(ξ))
# Y = (1 / (im * √2)) * (ξ * conj(η) - η * conj(ξ))
# Z = (1 / √2) * (ξ * conj(ξ) - η * conj(η))
# 𝕍(normalize(ℝ⁴(real.([T; X; Y; Z]))))
end


Expand Down
10 changes: 5 additions & 5 deletions src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ end


"""
makeflagplane(u, v)
makeflagplane(u, v, T)
Make a half plane with the given 4-vectors `u` and `v`.
Make a half plane with the given 4-vectors `u`, `v` and temporal section `T`.
"""
function makeflagplane(u::𝕍, v::𝕍; segments::Int = 60)
lspace1 = range(-1.0, stop = 1.0, length = segments)
lspace2 = range(0.0, stop = 1.0, length = segments)
function makeflagplane(u::𝕍, v::𝕍, T::Float64; segments::Int = 60)
lspace1 = range(-1.0, stop = T, length = segments)
lspace2 = range(0.0, stop = T, length = segments)
matrix = [f * u + s * v for f in lspace1, s in lspace2]
map(x -> projectnocompression(normalize((vec(x)))), matrix)
end
Expand Down

0 comments on commit affc62a

Please sign in to comment.