Helper function and General Utilities

List of all helper functions and utilities


TriMesh Utilities

Flux3D.normalize!Method
normalize!(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)
source
Flux3D.normalizeMethod
normalize(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)
source
Flux3D.offsetMethod
offset(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)
source
Flux3D.realign!Method
realign!(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)
source
Flux3D.realignMethod
realign(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)
source
Flux3D.rotate!Method
rotate!(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)
source
Flux3D.rotateMethod
rotate(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)
source
Flux3D.sample_pointsMethod
sample_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)
source
Flux3D.scale!Method
scale!(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])
source
Flux3D.scaleMethod
scale(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])
source
Flux3D.translate!Method
translate!(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])
source
Flux3D.translateMethod
translate(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])
source

PointCloud Utilities

Flux3D.normalize!Method
normalize!(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)
source
Flux3D.normalizeMethod
normalize(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)
source
Flux3D.realign!Method
realign!(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)
source
Flux3D.realignMethod
realign(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)
source
Flux3D.rotate!Method
rotate!(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)
source
Flux3D.rotateMethod
rotate(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)
source
Flux3D.scale!Method
scale!(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)
source
Flux3D.scaleMethod
scale(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)
source