Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Colors = "0.9, 0.10, 0.11, 0.12"
CoordinateTransformations = "0.5, 0.6"
DocStringExtensions = "0.5, 0.6, 0.7, 0.8"
FFMPEG = "0.2, 0.3, 0.4"
GeometryBasics = "0.3"
GeometryBasics = "0.3, 0.4"
MeshIO = "0.4"
Meshing = "0.5"
MsgPack = "1"
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ settransform!(vis, Translation(-0.5, -0.5, 0))

```julia
using ColorTypes
verts = rand(Point3f0, 100_000)
verts = rand(Point3f, 100_000)
colors = [RGB(p...) for p in verts]
setobject!(vis, PointCloud(verts, colors))
```
Expand Down
6 changes: 3 additions & 3 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"For a much more efficient point cloud, try using a vector of `StaticVector`s from StaticArrays.jl. The `Point3f0` is one such static vector:\n"
"For a much more efficient point cloud, try using a vector of `StaticVector`s from StaticArrays.jl. The `Point3f` is one such static vector:\n"
]
},
{
Expand All @@ -449,8 +449,8 @@
"metadata": {},
"outputs": [],
"source": [
"using GeometryBasics: Point3f0\n",
"points = rand(Point3f0, 1000000)\n",
"using GeometryBasics: Point3f\n",
"points = rand(Point3f, 1000000)\n",
"setobject!(vis[:pointcloud], PointCloud(points))"
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/MeshCat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using GeometryBasics: GeometryBasics,
NgonFace,
OffsetInteger,
Point,
Point3f0,
Point3f,
Polytope,
SimplexFace,
Vec,
Expand Down
12 changes: 6 additions & 6 deletions src/lowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ end

function lower(t::Triad)
attributes = Dict{String, Any}(
"position" => lower([Point3f0(0, 0, 0), Point3f0(t.scale, 0, 0),
Point3f0(0, 0, 0), Point3f0(0, t.scale, 0),
Point3f0(0, 0, 0), Point3f0(0, 0, t.scale)]),
"position" => lower([Point3f(0, 0, 0), Point3f(t.scale, 0, 0),
Point3f(0, 0, 0), Point3f(0, t.scale, 0),
Point3f(0, 0, 0), Point3f(0, 0, t.scale)]),
"color" => lower([RGB{Float32}(1,0,0), RGB{Float32}(1,0.6000000238418579,0),
RGB{Float32}(0,1,0), RGB{Float32}(0.6000000238418579,1,0),
RGB{Float32}(0,0,1), RGB{Float32}(0,0.6000000238418579,1)])
Expand Down Expand Up @@ -147,7 +147,7 @@ lower(faces::Vector{<:AbstractFace}) = lower(to_zero_index.(faces))
function lower(mesh_meta::M) where {M <: AbstractMesh}
mesh = metafree(mesh_meta)
attributes = Dict{String, Any}(
"position" => lower(convert(Vector{Point3f0}, decompose(Point3f0, mesh))),
"position" => lower(convert(Vector{Point3f}, decompose(Point3f, mesh))),
)
if M <: MeshMeta
metadata = meta(mesh_meta)
Expand Down Expand Up @@ -175,11 +175,11 @@ Fallback for everything else (like Polyhedra.jl's Polyhedron types)
$(TYPEDSIGNATURES)
"""
lower(g::GeometryPrimitive) = lower(GeometryBasics.Mesh(
decompose(Point3f0, g), decompose(GLTriangleFace, g)))
decompose(Point3f, g), decompose(GLTriangleFace, g)))

function lower(cloud::PointCloud)
attributes = Dict{String, Any}(
"position" => lower(convert(Vector{Point3f0}, cloud.position)),
"position" => lower(convert(Vector{Point3f}, cloud.position)),
)
if !isempty(cloud.color)
attributes["color"] = lower(convert(Vector{RGB{Float32}}, cloud.color))
Expand Down
4 changes: 2 additions & 2 deletions test/visualizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ end
v = vis[:points]
settransform!(v, Translation(-1, 0, 0))
@testset "random points" begin
verts = rand(Point3f0, 100000);
verts = rand(Point3f, 100000);
colors = reinterpret(RGB{Float32}, verts);
setobject!(v[:random], PointCloud(verts, colors))
settransform!(v[:random], Translation(-0.5, -0.5, 0))
Expand All @@ -191,7 +191,7 @@ end
v = vis[:points_with_material]
settransform!(v, Translation(-1.5, -2.5, 0))
material = PointsMaterial(color=RGBA(0,0,1,0.5))
cloud = PointCloud(rand(Point3f0, 5000))
cloud = PointCloud(rand(Point3f, 5000))
obj = Object(cloud, material)
@test MeshCat.threejs_type(obj) == "Points"
setobject!(v, cloud, material)
Expand Down