Coder Social home page Coder Social logo

cornelmpop / lithics3d Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 3.0 78.46 MB

An R package for processing and analyzing 3D scans of archaeological lithics

License: GNU General Public License v2.0

R 100.00%
archaeology lithics r 3d-models lithic-analysis r-package

lithics3d's Introduction

DOI

Lithics3D

Lithics3D provides a toolbox for working with 3D scans of archaeological lithics (and other objects) within the R environment. The functions included herein are designed to work with clean triangular meshes. For the time being at least, mesh generation and pre-processing (e.g. cleaning) must be done with different tools (e.g. Meshlab).

The included functions can be divided into three broad categories:

  • High-level functions for (semi-)automatic segmentation and analysis of meshes qua archaeological artifacts (e.g. utilities for automatically measuring edge angles, mapping artifact thickness).

  • Low-level functions for working with meshes as geometric objects. These functions are meant to provide the building blocks required to implement more complex functionality.

  • Interactive functions for visual mesh processing (e.g., selecting points and paths of interest on the object's surface).

Warning: A note on current status

This package incorporates functions written over a period of several years. Some of these functions are far more experimental than others, and there are many naming inconsistencies which are slowly being resolved. You can expect function names to change without notice, but all functions added in or since the v0.4.0 release will continue working as originally documented until version 1 of the package.

Given the experimental nature of some of the functions included in this package you are strongly encouraged to double check your results and contact me for help or clarification, or better yet, open an issue (see Lithics3D Issues)! More generally, be mindful of the fact that this is very much a work in progress.

Getting started

Installation

If you haven't done so already, install devtools in R:

install.packages("devtools")

Once devtools is available you can install Lithics3D from github with the following R commands:

require(devtools)
install_github("cornelmpop/Lithics3D", dependencies=T, build_vignettes=T)

Using Lithics3D

For basic information about the package, including a list of available functions and data, please load the package and consult the manual:

library(Lithics3D)
?Lithics3D

You should also explore the available vignette (a work in progress!) or contribute your own (contributions are very welcome!). To view the Lithics3D vignette:

vignette("Lithics3D")

lithics3d's People

Contributors

cornelmpop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lithics3d's Issues

Fix mesh_tmap_plot

There are numerous known issues with the mesh_tmap_plot function, and they should be fixed:

  • poor input checking
  • seemingly bogus artifacts in the output (e.g., with mesh_tmap_plot(mesh_tmap(demoFlake1$mesh, base.res = 0.1, ld.cutoff = 0.05)$tmap, font_size = 12))
  • no unit tests

mesh_segment_by_path silently drops mesh faces

The function drops some faces that clearly should not be dropped. A reproducible example:

mesh <- demoSphere
pois <- t(demoSphere$vb)[c(1, 20, 30, 45), 1:3]
mesh_path <- sPathConnect(pois, mesh, closed = TRUE)
res <- mesh_segment_by_path(mesh, mesh.path = mesh_path)

#' No purple face from the un-split mesh should be visible, but one is because the split
#' mesh segments don't cover the whole surface (i.e., a face was dropped)
shade3d(mesh, col = "purple", alpha = 0.9)
shade3d(res[[1]], col = "red")
shade3d(res[[2]], col = "green")

coords_onseg - incorrect output

The following input should produce one TRUE value, but the output is FALSE, FALSE:

seg <- data.frame(x = c(-7.249440, -7.282816),
y = c(0.5743027, 0.9284002),
z = c(502.5920, 502.8661))
coords <- data.frame(x = c(-7.259582, -7.455739),
y = c(0.6819025, 2.7629832),
z = c(502.6753, 504.2863))
coords_onseg(coords, seg, tol = 0.01) # FALSE FALSE

dist_pt2l(coords, seg) # Not perfect, but clearly within a reasonable threshold of the line

Plot to visualize - one point is clearly on the segment:

lines3d(seg, col = "red")
points3d(coords, col = "blue")

Reduce size of included demo meshes.

The included data files are too large (~30 MB with compression), well above the CRAN limit. I don't think there is a good reason for the included demo meshes to be that big, so: a) reduce the meshes to something more reasonable, and b) make sure everything (e.g., examples) still works as expected.

Fix ptOnSeg

The function was left in an unfinished state back in 2019. The d.t parameter is currently ignored and the output is not tested, so that needs fixing; the function should also be renamed to conform to current naming standards.

Apply consistent approach to function deprecation

Functions that are deprecated should be documented in a similar way:

  • lifecycle tag - deprecated or superseded.
  • title and description: (Deprecated) - as done in align_pca.R.
  • description: explain rationale for deprecation and what function takes over, if any, with a direct link to the latter. If possible, provide an example of how the same functionality can be obtained through the function that replaces it.
  • Add a document where this process is documented (for the future).

Discrepancy between output of edge_angles_yw and the Virtual Goniometer Meshlab plugin

There is a major (18 degrees) difference in the outputs of the edge_angles_yw and Virtual Goniometer Meshlab plugin with the following inputs:

mesh <- Rvcg::vcgUpdateNormals(demoFlake2$mesh)
res <- edge_angles_yw(mesh = mesh, poi = data.frame(x = c(16.395319), y = c(51.524971), z = c(409.201294)), radius = 2.994467, lambda = 2)

The angle computed above is 121.166, while the Meshlab plugin returns an angle of 139.2329.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.