Helper function and General Utilities
List of all helper functions and utilities
Flux3D.normalize
Flux3D.normalize
Flux3D.normalize!
Flux3D.normalize!
Flux3D.offset
Flux3D.realign
Flux3D.realign
Flux3D.realign!
Flux3D.realign!
Flux3D.rotate
Flux3D.rotate
Flux3D.rotate!
Flux3D.rotate!
Flux3D.sample_points
Flux3D.scale
Flux3D.scale
Flux3D.scale!
Flux3D.scale!
Flux3D.translate
Flux3D.translate!
TriMesh Utilities
Flux3D.normalize!
— Methodnormalize!(m::TriMesh)
Normalize each mesh in TriMesh m
with mean centered at origin and unit standard deviation and overwrite the m
with normalized TriMesh.
See also: normalize
Examples:
julia> m = load_trimesh("teapot.obj")
julia> normalize!(m)
Flux3D.normalize
— Methodnormalize(m::TriMesh)
Normalize each mesh in TriMesh m
with mean centered at origin and unit standard deviation
See also: normalize!
Examples:
julia> m = load_trimesh("teapot.obj")
julia> m = normalize(m)
Flux3D.offset
— Methodoffset(m::TriMesh, offset_verts_packed::AbstractArray{<:Number,2})
Add offset to the vertices of the TriMesh m
by offset vertices offset_verts_packed
.
See also: offset!
Examples:
julia> m = load_trimesh("teapot.obj")
julia> offset_verts = ones(get_verts_packed(m))
julia> m = offset(m, offset_verts)
Flux3D.realign!
— Methodrealign!(src::TriMesh, tgt::TriMesh)
realign!(src::TriMesh, tgt_min::AbstractArray{<:Number,2}, tgt_max::AbstractArray{<:Number,2})
Re-Align the TriMesh src
with the axis aligned bounding box of mesh at index
in TriMesh tgt
and overwrite src
with re-aligned TriMesh.
See also: realign
Examples:
julia> src = load_trimesh("teapot.obj")
julia> tgt = scale(src, 2.0)
julia> realign!(src, tgt)
Flux3D.realign
— Methodrealign(src::TriMesh, tgt::TriMesh, index::Integer=1)
realign(src::TriMesh, tgt_min::AbstractArray{<:Number,2}, tgt_max::AbstractArray{<:Number,2})
Re-Align the TriMesh src
with the axis aligned bounding box of mesh at index
in TriMesh tgt
.
See also: realign
Examples:
julia> src = load_trimesh("teapot.obj")
julia> tgt = scale(src, 2.0)
julia> src = realign(src, tgt)
Flux3D.rotate!
— Methodrotate!(m::TriMesh, rotmat::AbstractArray{<:Number,2})
rotate!(m::TriMesh, rotmat::AbstractArray{<:Number,3})
Rotate the TriMesh m
by rotation matrix rotmat
and overwrite m
with rotated TriMesh.
Rotation matrix rotmat
should be of size (3,3)
or (3,3,B)
where B is the batch size of TriMesh.
See also: rotate
Examples:
julia> m = load_trimesh("teapot.obj")
julia> rotmat = rand(3,3)
julia> rotate!(m, rotmat)
Flux3D.rotate
— Methodrotate(m::TriMesh, rotmat::AbstractArray{<:Number,2})
Rotate the TriMesh m
by rotation matrix rotmat
.
Rotation matrix rotmat
should be of size (3,3)
See also: rotate!
Examples:
julia> m = load_trimesh("teapot.obj")
julia> rotmat = rand(3,3)
julia> m = rotate(m, rotmat)
Flux3D.sample_points
— Methodsample_points(m::TriMesh, num_samples::Int=5000; returns_normals::Bool=false, eps::Number = 1e-6)
Uniformly samples num_samples
points from the surface of TriMesh m
.
returns_normals
is optional keyword argument, to returns normals from respective faces of samples. eps
is optional keyword argument for a small number to prevent division by zero for small surface areas.
Examples:
julia> m = load_trimesh("teapot.obj")
julia> points = sample_points(m, 5000)
julia> points, normals = sample_points(m, 5000; returns_normals=true)
Flux3D.scale!
— Methodscale!(m::TriMesh, factor::Number)
scale!(m::TriMesh, factor::AbstractArray{<:Number})
Scale the TriMesh m
by scaling factor factor
and overwrite m
with scaled TriMesh. If factor
is array of size (3, )
, then TriMesh will be scale by scaling factor of respective dimension.
Scaling factor factor
(each element in case of array) should be strictly greater than 0.0
.
See also: scale
Examples:
julia> m = load_trimesh("teapot.obj")
julia> scale!(m, 1.0)
julia> scale!(m, [1.0, 1.0, 1.0])
Flux3D.scale
— Methodscale(m::TriMesh, factor::Number)
scale(m::TriMesh, factor::AbstractArray{<:Number})
Scale the TriMesh m
by scaling factor factor
. If factor
is array of size (3, )
, then TriMesh will be scaleby scaling factor of respective dimension.
Scaling factor factor
(each element in case of array) should be strictly greater than 0.0
.
See also: scale!
Examples:
julia> m = load_trimesh("teapot.obj")
julia> m = scale(m, 1.0)
julia> m = scale!(m, [1.0, 1.0, 1.0])
Flux3D.translate!
— Methodtranslate!(m::TriMesh, vector::Number)
translate!(m::TriMesh, vector::AbstractArray{<:Number})
Translate the TriMesh m
by translating vector vector
and overwrite m
with translated TriMesh. If vector
is a number, then TriMesh will be translated by same number in all dimension.
See also: translate
Examples:
julia> m = load_trimesh("teapot.obj")
julia> translate!(m, 0.0)
julia> translate!(m, [0.0, 0.0, 0.0])
Flux3D.translate
— Methodtranslate(m::TriMesh, vector::Number)
translate(m::TriMesh, vector::AbstractArray{<:Number})
Translate the TriMesh m
by translating vector vector
. If vector
is a number, then TriMesh will be translated by same number in all dimension.
See also: translate!
Examples:
julia> m = load_trimesh("teapot.obj")
julia> m = translate(m, 0.0)
julia> m = translate(m, [0.0, 0.0, 0.0])
PointCloud Utilities
Flux3D.normalize!
— Methodnormalize!(pcloud::PointCloud)
Normalize the PointCloud pcloud
with mean centered at origin and unit standard deviation and overwrite the pcloud with normalized PointCloud.
See also: normalize
Examples:
julia> p = PointCloud(rand(1024,3))
julia> normalize!(p)
Flux3D.normalize
— Methodnormalize(pcloud::PointCloud)
Normalize the PointCloud pcloud
with mean centered at origin and unit standard deviation
See also: normalize!
Examples:
julia> p = PointCloud(rand(1024,3))
julia> p = normalize(p)
Flux3D.realign!
— Methodrealign!(src::PointCloud, tgt::PointCloud)
realign!(src::PointCloud, tgt_min::AbstractArray{<:Number,2}, tgt_max::AbstractArray{<:Number,2})
Re-Align the PointCloud src
with the axis aligned bounding box of PointCloud tgt
and overwrite pcloud
with re-aligned PointCloud.
PointCloud src
and tgt
should be of same dimension.
See also: realign
Examples:
julia> src = PointCloud(rand(1024,3))
julia> tgt = PointCloud(rand(1024,3))
julia> realign!(src, tgt)
Flux3D.realign
— Methodrealign(src::PointCloud, tgt::PointCloud)
realign(src::PointCloud, tgt_min::AbstractArray{<:Number,2}, tgt_max::AbstractArray{<:Number,2})
Re-Align the PointCloud src
with the axis aligned bounding box of PointCloud tgt
.
PointCloud src
and tgt
should be of same dimension.
See also: realign!
Examples:
julia> src = PointCloud(rand(1024,3))
julia> tgt = PointCloud(rand(1024,3))
julia> src = realign!(src, tgt)
Flux3D.rotate!
— Methodrotate!(pcloud::PointCloud, rotmat::AbstractArray{Number,2})
rotate!(pcloud::PointCloud, rotmat::AbstractArray{Number,3})
Rotate the PointCloud pcloud
by rotation matrix rotmat
and overwrite pcloud
with rotated PointCloud.
Rotation matrix rotmat
should be of size (3,3)
or (3,3,B)
where B is the batch size of PointCloud.
See also: rotate
Examples:
julia> p = PointCloud(rand(1024,3))
julia> rotmat = rand(3,3)
julia> rotate!(p, rotmat)
Flux3D.rotate
— Methodrotate(pcloud::PointCloud, rotmat::Array{<:Number})
Rotate the PointCloud pcloud
by rotation matrix rotmat
.
Rotation matrix rotmat
should be of size (3,3)
See also: rotate!
Examples:
julia> p = PointCloud(rand(1024,3))
julia> rotmat = rand(3,3)
julia> p = rotate(p, rotmat)
Flux3D.scale!
— Methodscale!(pcloud::PointCloud, factor::Number)
Scale the PointCloud pcloud
by scaling factor factor
and overwrite pcloud
with scaled PointCloud.
Scaling factor factor
should be strictly greater than 0.0
.
See also: scale
Examples:
julia> p = PointCloud(rand(1024,3))
julia> scale!(p, 1.0)
Flux3D.scale
— Methodscale(pcloud::PointCloud, factor::Number)
Scale the PointCloud pcloud
by scaling factor factor
.
Scaling factor factor
should be strictly greater than 0.0
.
See also: scale!
Examples:
julia> p = PointCloud(rand(1024,3))
julia> p = scale(1.0)