Title: | R Interface to Boundary First Flattening Software (BFF) |
---|---|
Description: | Flatten 3D meshes into arbitrary 2D shapes using boundary first flattening (<https://github.com/GeometryCollective/boundary-first-flattening>). |
Authors: | Russell Dinnage [aut, cre, cph] , Rohan Sawhney [ctb, cph], Keenan Crane [ctb, cph] |
Maintainer: | Russell Dinnage <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-10-26 04:57:21 UTC |
Source: | https://github.com/rdinnager/rbff |
Beetle 3d Model
beetle
beetle
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Flattening will only work with closed objects if cones are inserted (cuts or seams).
Closed objects can instead be mapped to a sphere however.
If both to_disk
and to_sphere
are FALSE
, a target boundary shape will be determined
automatically that minimized area and angle distortion. If you want to
flatten to a particular target boundary shape, use bff_flatten_to_shape()
bff_flatten( mesh, n_cones = 0, to_disk = FALSE, to_sphere = FALSE, normalise = TRUE )
bff_flatten( mesh, n_cones = 0, to_disk = FALSE, to_sphere = FALSE, normalise = TRUE )
mesh |
|
n_cones |
Number of cone singularities to insert into mesh to reduce distortion. Ignored
if |
to_disk |
Should the mesh be flattened to a disk? |
to_sphere |
Should the mesh be mapped to a sphere instead (only works with closed objects). |
normalise |
Should the 2d mapping be normalised between 0 and 1 on the x and y axes? |
A bff_flattened
object containing the original mesh and its flattened version with
corresponding vertices unless to_sphere = TRUE
, in which case a bff_sphered
object is returned.
data(face) options(rgl.useNULL = TRUE) flat_face <- bff_flatten(face)
data(face) options(rgl.useNULL = TRUE) flat_face <- bff_flatten(face)
Flatten a mesh to a particular boundary shape
bff_flatten_to_shape(mesh, boundary_shape, normalise = TRUE)
bff_flatten_to_shape(mesh, boundary_shape, normalise = TRUE)
normalise |
Place an image interactively on the flattened mesh and see it mapped to the original 3D mesh.
bff_place_image( x, expression = NULL, filename = NULL, tile = TRUE, bg = "white", alpha_flatten = FALSE, ... )
bff_place_image( x, expression = NULL, filename = NULL, tile = TRUE, bg = "white", alpha_flatten = FALSE, ... )
x |
A |
expression |
An R expression that generates an image. |
filename |
Alternative to expression: provide the file name of a png image directly |
tile |
If the image does not cover the whole flattened mesh, should it be tiled (e.g repeated) so that it fills the whole mesh? Also not implemented yet |
bg |
Background colour for if |
alpha_flatten |
Should the alpha channel be flattened? By default, parts of the mesh with
completely transparent colours will be invisible. Flattening removes the alpha channel
by layering the image over the |
... |
Further arguments passed to the graphic device is |
A bff_textured
object containing the original mesh with updated textcoords,
its flattened version, and the image for texture mapping
Visualise the result of flattening a 3d mesh.
bff_vis_metrics( x, metric = c("area distortion", "vertice density", "curvature", "mesh"), ... )
bff_vis_metrics( x, metric = c("area distortion", "vertice density", "curvature", "mesh"), ... )
x |
A |
metric |
Which metric to display. One of "area distortion", "vertice density", "curvature", or "mesh" |
... |
Additional arguments passed on to the drawing functions (shade3d() or wire3d()) |
None.
data(face) ## don't run the next line if you want to see the visualisation options(rgl.useNULL = TRUE) face_flat <- bff_flatten(face) bff_vis_metrics(face_flat)
data(face) ## don't run the next line if you want to see the visualisation options(rgl.useNULL = TRUE) face_flat <- bff_flatten(face) bff_vis_metrics(face_flat)
Box 3d Model
box
box
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Bunny 3d Model
bunny
bunny
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Cowhead 3d Model
cowhead
cowhead
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Face 3d Model
face
face
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Fish 3d Model
fish
fish
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Hemisphere 3d Model
hemisphere
hemisphere
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Kitten 3d Model
kitten
kitten
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Maze 3d Model
maze
maze
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Punctured Torus 3d Model
punctured_torus
punctured_torus
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Get the R logo png file path.
r_logo_png()
r_logo_png()
A file path to the R logo png
plot(imager::load.image(r_logo_png()))
plot(imager::load.image(r_logo_png()))
Spothead 3d Model
spothead
spothead
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input
Teapot 3d Model
teapot
teapot
A mesh3d
object.
https://github.com/GeometryCollective/boundary-first-flattening/tree/master/input