Transforms

Usage

Transforms can be applied to corresponding 3D structure. Chain can be used to compose multiple functions/transforms. Same as Flux.Chain.

Chain also supports indexing and slicing. See Example below.

Example

julia> t = Chain(ScalePointCloud(2.0), NormalizePointCloud())
Chain(ScalePointCloud(factor=2.0; inplace=true), NormalizePointCloud(;inplace=true))

julia> p = PointCloud(rand(1024,3))
PointCloud{Float32} Structure:
    Batch size: 1
    Points: 3
    Normals 0
    Storage type: Array{Float32,3}

julia> t(p) == t[2](t[1](p))
true

julia> m = load_trimesh("teapot.obj")
TriMesh{Float32, UInt32, Array} Structure:
    Batch size: 1
    Max verts: 1202
    Max faces: 2256
    offset: -1
    Storage type: Array

julia> t = NormalizeTriMesh()
NormalizeTriMesh(;inplace=true)

julia> t(m)
TriMesh{Float32, UInt32, Array} Structure:
    Batch size: 1
    Max verts: 1202
    Max faces: 2256
    offset: -1
    Storage type: Array

List of all available Transforms


TriMesh Transforms

Flux3D.NormalizeTriMeshType
NormalizeTriMesh(; inplace::Bool=true)

Normalize TriMesh with mean at origin and unit standard deviation.

inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of TriMesh.

See also: normalize, normalize!

source
Flux3D.ScaleTriMeshType
ScaleTriMesh(factor::Number; inplace::Bool=true)

Scale TriMesh with a given scaling factor factor.

factor should be strictly greater than 0.0 for obvious reason. inplace is optional keyword argument, to make transformation in-place. If inplace is set to false, it will create deepcopy of TriMesh. Given factor, this transform scale each vertices in TriMesh, ie. point = point * factor

See also: scale, scale!

source
Flux3D.RotateTriMeshType
RotateTriMesh(rotmat::AbstractArray{<:Number,2}; inplace::Bool=true)

Rotate vertices of TriMesh with a given rotation matrix rotmat.

rotmat must be AbstractArray{<:Number,2} of size (3,3). inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of TriMesh. Given rotmat, this transform will rotate each vertices coordinates (ie. x,y,z) in TriMesh.

See also: rotate, rotate!

source
Flux3D.ReAlignTriMeshType
ReAlignTriMesh(target::TriMesh; inplace::Bool=true)

Re-Align TriMesh to axis aligned bounding box of mesh at index in TriMesh target.

inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of TriMesh.

See also: realign, realign!

source
Flux3D.TranslateTriMeshType
TranslateTriMesh(vector::AbstractArray{<:Number}; inplace::Bool=true)

Translate TriMesh with given translation vector.

inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of TriMesh.

See also: translate, translate!

source
Flux3D.OffsetTriMeshType
OffsetTriMesh(offset_verts::AbstractArray{<:Number,2}; inplace::Bool=true)

Add offset to the TriMesh by given offset vertices offset_verts

inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of TriMesh.

See also: offset, offset!

source

PointCloud Transforms

Flux3D.NormalizePointCloudType
NormalizePointCloud(; inplace::Bool=true)

Normalize PointCloud with mean at origin and unit standard deviation.

inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of PointCloud.

See also: normalize, normalize!

source
Flux3D.ScalePointCloudType
ScalePointCloud(factor::Number; inplace::Bool=true)

Scale PointCloud with a given scaling factor factor.

factor should be strictly greater than 0.0 for obvious reason. inplace is optional keyword argument, to make transformation in-place. If inplace is set to false, it will create deepcopy of PointCloud. Given factor, this transform scale each point in PointCloud, ie. point = point * factor

See also: scale, scale!

source
Flux3D.RotatePointCloudType
RotatePointCloud(rotmat::AbstractArray{<:Number,2}; inplace::Bool=true)

Rotate PointCloud with a given rotation matrix rotmat.

rotmat must be AbstractArray{<:Number,2} of size (3,3). inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of PointCloud. Given rotmat, this transform will rotate each point coordinates (ie. x,y,z) in PointCloud.

See also: rotate, rotate!

source
Flux3D.ReAlignPointCloudType
ReAlignPointCloud(target::PointCloud; inplace::Bool=true)
ReAlignPointCloud(target::AbstractArray{<:Number, 2}; inplace::Bool=true)

Re-Align PointCloud to axis aligned bounding box of target PointCloud.

input PointCloud and target PointCloud should be of same size. inplace is optional keyword argument, to make transformation in-place If inplace is set to false, it will create deepcopy of PointCloud.

See also: realign, realign!

source

Conversions Transforms

Flux3D.VoxelGridToTriMeshType
VoxelGridToTriMesh(; threshold=0.5, algo=:Exact)

Converts a VoxelGrid to TriMesh.

threshold is the threshold from which to make binary voxels, and algo is the mode to be used to convert binary voxels. Available algo are [:Exact, :MarchingCubes, :MarchingTetrahedra, :NaiveSurfaceNets].

See also: TriMesh, VoxelGrid

source
Flux3D.VoxelGridToPointCloudType
VoxelGridToPointCloud(npoints::Int=1000; threshold=0.5, algo=:Exact)

Converts a VoxelGrid to PointCloud having npoints.

threshold is the threshold from which to make binary voxels, and algo is the mode to be used to convert binary voxels. Available algo are [:Exact, :MarchingCubes, :MarchingTetrahedra, :NaiveSurfaceNets].

See also: PointCloud, VoxelGrid

source