Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
BrianGun/issue365 (#366)
Browse files Browse the repository at this point in the history
* Fix long standing deprecation warnings
Fixes #365

replace Vec3f0 with Vec3f and Point3f0 with Point3f

* removed redundant import of Quantities and Units from Unitful

* removed redundant redefinition of T
  • Loading branch information
BrianGun authored Feb 9, 2022
1 parent 44e2afa commit c386906
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/GlassCat/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DelimitedFiles: readdlm # used in agffile_to_catalog
using StringEncodings
using StaticArrays
using Unitful
import Unitful: Length, Temperature, Quantity, Units
import Unitful: Length, Temperature

"""
generate_jls(sourcenames::Vector{<:AbstractString}, mainfile::AbstractString, jldir::AbstractString, agfdir::AbstractString; test::Bool = false)
Expand Down
1 change: 0 additions & 1 deletion src/Optical/Emitters/Spectrum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct Measured{T} <: AbstractSpectrum{T}

power::Vector{T} where {T<:Real} = samples[!, :Power] # no missing values allowed and must be real numbers
maxpower = maximum(power)
T = eltype(power)
p = sortperm(wavelengths)
wavelengths = wavelengths[p]
power = power[p] ./ maxpower #make sure power values have the same sorted permutation as wavelengths normalized with maximum power equal to 1
Expand Down
12 changes: 6 additions & 6 deletions src/Vis/Emitters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ function maybe_draw_debug_info(scene::Makie.LScene, o::Origins.AbstractOriginDis
arrow_size = ARRROW_SIZE * visual_size(o)
arrow_start = pos
arrow_end = dir * ARRROW_LENGTH * visual_size(o)
Makie.arrows!(scene.scene, [Makie.Point3f0(arrow_start)], [Makie.Point3f0(arrow_end)], arrowsize=arrow_size, linewidth=arrow_size * 0.5, linecolor=:blue, arrowcolor=:blue)
Makie.arrows!(scene.scene, [Makie.Point3f(arrow_start)], [Makie.Point3f(arrow_end)], arrowsize=arrow_size, linewidth=arrow_size * 0.5, linecolor=:blue, arrowcolor=:blue)
arrow_end = uv * 0.5 * ARRROW_LENGTH * visual_size(o)
Makie.arrows!(scene.scene, [Makie.Point3f0(arrow_start)], [Makie.Point3f0(arrow_end)], arrowsize= 0.5 * arrow_size, linewidth=arrow_size * 0.5, linecolor=:red, arrowcolor=:red)
Makie.arrows!(scene.scene, [Makie.Point3f(arrow_start)], [Makie.Point3f(arrow_end)], arrowsize= 0.5 * arrow_size, linewidth=arrow_size * 0.5, linecolor=:red, arrowcolor=:red)
arrow_end = vv * 0.5 * ARRROW_LENGTH * visual_size(o)
Makie.arrows!(scene.scene, [Makie.Point3f0(arrow_start)], [Makie.Point3f0(arrow_end)], arrowsize= 0.5 * arrow_size, linewidth=arrow_size * 0.5, linecolor=:green, arrowcolor=:green)
Makie.arrows!(scene.scene, [Makie.Point3f(arrow_start)], [Makie.Point3f(arrow_end)], arrowsize= 0.5 * arrow_size, linewidth=arrow_size * 0.5, linecolor=:green, arrowcolor=:green)

# draw all the samples origins
positions = map(x -> transform*x, collect(o))
positions = collect(Makie.Point3f0, positions)
positions = collect(Makie.Point3f, positions)
Makie.scatter!(scene, positions, color=:green, markersize = MARKER_SIZE * visual_size(o))

# positions = collect(Makie.Point3f0, o)
# positions = collect(Makie.Point3f, o)
# Makie.scatter!(scene, positions, color=:green, markersize = MARKER_SIZE * visual_size(o))
end

Expand Down Expand Up @@ -121,7 +121,7 @@ function OpticSim.Vis.draw!(scene::Makie.LScene, s::Sources.Source{T}; parent_tr

m[:, 4:6] .*= m[:, 7] * ARRROW_LENGTH * visual_size(s.origins)

# Makie.arrows!(scene, [Makie.Point3f0(origin(ray))], [Makie.Point3f0(rayscale * direction(ray))]; kwargs..., arrowsize = min(0.05, rayscale * 0.05), arrowcolor = color, linecolor = color, linewidth = 2)
# Makie.arrows!(scene, [Makie.Point3f(origin(ray))], [Makie.Point3f(rayscale * direction(ray))]; kwargs..., arrowsize = min(0.05, rayscale * 0.05), arrowcolor = color, linecolor = color, linewidth = 2)
color = :yellow
arrow_size = ARRROW_SIZE * visual_size(s.origins)
Makie.arrows!(scene, m[:,1], m[:,2], m[:,3], m[:,4], m[:,5], m[:,6]; kwargs..., arrowcolor=color, linecolor=color, arrowsize=arrow_size, linewidth=arrow_size*0.5)
Expand Down
18 changes: 9 additions & 9 deletions src/Vis/Visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ function make2dy(scene::Makie.LScene = current_3d_scene)
# use 2d camera
Makie.cam2d!(s)

scene_transform = Makie.qrotation(Makie.Vec3f0(0, 1, 0), 0.5pi)
scene_transform_inv = Makie.qrotation(Makie.Vec3f0(0, 1, 0), -0.5pi) # to use with the ticks and names
scene_transform = Makie.qrotation(Makie.Vec3f(0, 1, 0), 0.5pi)
scene_transform_inv = Makie.qrotation(Makie.Vec3f(0, 1, 0), -0.5pi) # to use with the ticks and names

# set rotation to look onto yz plane
s.transformation.rotation[] = scene_transform
Expand Down Expand Up @@ -186,8 +186,8 @@ function make2dx(scene::Makie.LScene = current_3d_scene)
# use 2d camera
Makie.cam2d!(s)

scene_transform= Makie.qrotation(Makie.Vec3f0(0, 0, 1), 0.5pi) * Makie.qrotation(Makie.Vec3f0(1, 0, 0), 0.5pi)
scene_transform_inv=Makie.qrotation(Makie.Vec3f0(1, 0, 0), -0.5pi) * Makie.qrotation(Makie.Vec3f0(0, 0, 1), -0.5pi)
scene_transform= Makie.qrotation(Makie.Vec3f(0, 0, 1), 0.5pi) * Makie.qrotation(Makie.Vec3f(1, 0, 0), 0.5pi)
scene_transform_inv=Makie.qrotation(Makie.Vec3f(1, 0, 0), -0.5pi) * Makie.qrotation(Makie.Vec3f(0, 0, 1), -0.5pi)

# set rotation to look onto yz plane
s.transformation.rotation[] = scene_transform
Expand Down Expand Up @@ -353,8 +353,8 @@ function draw!(scene::Makie.LScene, surf::Surface{T}; numdivisions::Int = 30, no
end
draw!(scene, mesh; kwargs..., normals = false)
if normals
ndirs = Makie.Point3f0.(samplesurface(surf, normal, numdivisions ÷ 10))
norigins = Makie.Point3f0.(samplesurface(surf, point, numdivisions ÷ 10))
ndirs = Makie.Point3f.(samplesurface(surf, normal, numdivisions ÷ 10))
norigins = Makie.Point3f.(samplesurface(surf, point, numdivisions ÷ 10))
Makie.arrows!(scene, norigins, ndirs, arrowsize = 0.2, arrowcolor = normalcolor, linecolor = normalcolor, linewidth = 2)
end
end
Expand All @@ -379,8 +379,8 @@ function draw!(scene::Makie.LScene, tmesh::TriangleMesh{T}; linewidth = 3, shade
end
if normals
@warn "Normals being drawn from triangulated mesh, precision may be low"
norigins = [Makie.Point3f0(centroid(t)) for t in tmesh.triangles[1:10:end]]
ndirs = [Makie.Point3f0(normal(t)) for t in tmesh.triangles[1:10:end]]
norigins = [Makie.Point3f(centroid(t)) for t in tmesh.triangles[1:10:end]]
ndirs = [Makie.Point3f(normal(t)) for t in tmesh.triangles[1:10:end]]
if length(norigins) > 0
Makie.arrows!(scene, norigins, ndirs, arrowsize = 0.2, arrowcolor = normalcolor, linecolor = normalcolor, linewidth = 2)
end
Expand Down Expand Up @@ -619,7 +619,7 @@ Draw a [`Ray`](@ref) in a given `color` optionally scaling the size using `raysc
"""
function draw!(scene::Makie.LScene, ray::AbstractRay{T,N}; color = :yellow, rayscale = 1.0, kwargs...) where {T<:Real,N}
arrow_size = min(0.05, rayscale * 0.05)
Makie.arrows!(scene, [Makie.Point3f0(origin(ray))], [Makie.Point3f0(rayscale * direction(ray))]; kwargs..., arrowsize = arrow_size, arrowcolor = color, linecolor = color, linewidth=arrow_size * 0.5)
Makie.arrows!(scene, [Makie.Point3f(origin(ray))], [Makie.Point3f(rayscale * direction(ray))]; kwargs..., arrowsize = arrow_size, arrowcolor = color, linecolor = color, linewidth=arrow_size * 0.5)
end

"""
Expand Down

0 comments on commit c386906

Please sign in to comment.