natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
62 stars 26 forks source link

WIP: added hxsurf addition #482

Closed dokato closed 2 years ago

dokato commented 2 years ago

I needed an easy way to concatenate 2 hxsurfs, I did not find any better way to do it, so I implemented this simple method. For example:

h1 = as.hxsurf(icosahedron3d(), 'a')
h2 = as.hxsurf(tetrahedron3d(), 'b')
h3=h1+h2
plot3d(h3)

Screenshot 2021-09-01 at 15 20 38

The problem is that right now hxsurf inherits operations from dotprops, which makes sense for most but not all of them.

Ops.hxsurf <- Ops.dotprops

I'm not sure how to point the package to what is the desired method to call in that case.

codecov[bot] commented 2 years ago

Codecov Report

Merging #482 (a30153e) into master (b8d420c) will increase coverage by 0.04%. The diff coverage is 93.33%.

:exclamation: Current head a30153e differs from pull request most recent head 2cac57d. Consider uploading reports for the commit 2cac57d to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master     #482      +/-   ##
==========================================
+ Coverage   76.80%   76.84%   +0.04%     
==========================================
  Files          47       47              
  Lines        5863     5878      +15     
==========================================
+ Hits         4503     4517      +14     
- Misses       1360     1361       +1     
Impacted Files Coverage Δ
R/hxsurf.R 91.15% <93.33%> (+0.10%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b8d420c...2cac57d. Read the comment docs.

jefferis commented 2 years ago

Thanks a lot for this @dokato. I think this is where S3 methods are not so good as really the method to choose here depends on both arguments i.e. whether to do arithmetic or join things together. I would actually sidestep this by using c i.e. c.hxsurf or merge rather than + for this functionality.