Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim down GeometryBasics and remove all type complexity #173

Merged
merged 69 commits into from
Oct 17, 2024

Conversation

SimonDanisch
Copy link
Member

@SimonDanisch SimonDanisch commented Mar 17, 2022

For a summary of changes in the 0.5 release, see #226 (comment) or the release tag


So... I tried for a very long time to create a Geometry package that serves all use cases and can be used as a foundation for all other Geometry packages without any performance problems for any domain. This never really worked out for a bunch of reasons.
While GeometryBasics was never used that way, all the ideal requirements I aimed for have turned GeometryBasics into a very overengineered package, with long compile times and complex types.
I never really had a lot of time to actually maintain and grow it though, so on top of being overly complex it has been poorly documented. I also tried to integrate lots of types like LineStrings, which I don't know very well and when to use them :D
So, this PR is slimming down GeometryBasics to the very basics that I need in Makie, which should help a lot with compile times and maintainability.

It changes:

  • removes all kind of meta infrastructure, only leaving a simple MetaMesh type that can hold e.g. uv and normals
  • remove table interface
  • less type artistry and instead tries to use the most simple types as possible
  • copies more instead of creating horrible types like StructArray{ReinterpretArray{SubArray{Int64, 1, Vector{Int64}, Tuple{UnitRange{Int64}}, true}}} (this is even shortened :D )
  • Make Point +/-/* Vec consistent

Fixes:

Will not be in the scope of this package anymore:

@SimonDanisch SimonDanisch changed the base branch from master to sd/no-sarray March 17, 2022 20:38
@SimonDanisch SimonDanisch changed the base branch from sd/no-sarray to master March 17, 2022 20:47
@SimonDanisch SimonDanisch reopened this Mar 17, 2022
@evetion
Copy link
Contributor

evetion commented Apr 25, 2022

This is some good cleanup! This is on top of #169 right?

Over at JuliaGeo/GeoInterface.jl#33, we're now (finally) finishing a new Traits based interface. This gets rid of all the required subtyping on GeoInterface.Geometries and I would like to update the GeoInterface implementation in GeometryBasics here as well.

In that context, I see you removed LineString and changed the decomposition in this PR. In GeoInterface we still assume a Polygon decomposes into 1 or multiple LineStrings like instances (exterior ring and any interiors), which themselves decompose into Pointlikes. Do you think we could still make that work in this PR? Would Line be a proper replacement, or is it just two points?

@SimonDanisch
Copy link
Member Author

Yes, I think we can bring it back, if we document a bit better what its supposed to be used for!
I think we should keep them as simple as possible, so maybe something like:

struct LineString{N, T}
   line::Vector{Point{N, T}}
end

struct MultiLineString{N, T}
   lines::Vector{LineString{N, T}}
end

@evetion
Copy link
Contributor

evetion commented May 11, 2022

@SimonDanisch Is it ok to revive https://github.com/JuliaGeometry/GeometryBasics.jl/compare/master...visr:rfc?expand=1 on the current master of GeometryBasics? Or would you like me to open a PR, based on the changes in this PR? Also depends on your expected timeline of this PR?

@SimonDanisch
Copy link
Member Author

No, that sounds great :) Looks like it has 0 dependencies, so that makes things a lot easier ;)
I think master is fine... It's such a small diff, that it should be easy enough to rebase in this PR.

@evetion
Copy link
Contributor

evetion commented Jun 12, 2022

No, that sounds great :) Looks like it has 0 dependencies, so that makes things a lot easier ;) I think master is fine... It's such a small diff, that it should be easy enough to rebase in this PR.

Ok 👍🏻 , I've made a first attempt over at #175.

ffreyer and others added 27 commits September 4, 2024 17:40
* update MetaMesh

* add MultiFace type

* update Mesh & MultiFace types

* update Mesh & MetaMesh utils

* add MultiFace remapping code

* prototype MultiFace Rect -> Mesh pipeline

* generalize MultiFace getindex to Integer

* remove add_meta, pop_meta

* update merge for MultiFace and views

* add AbstractVertexFace and AbstractMultiFace

* split up  mesh() for better usability

* minor fixes

* add views to Mesh constructors

* add `mesh()` method for converting facetype of mesh

* switch back to "normals"

* fix missing normals rename

* add back point/normal/uv-type kwargs

* consider face views in face decompose

* add mesh(mesh; attribs...) & improve dispatch safety

* fix normals(), cleanup tests

* add mesh constructor tests + fixes

* deprecate normals for normal as vertex attribute name

* make NormalFace and NormalUVFace types again

* cleanup tests & normals vs normal

* let ci run

* remove views aware face decomposition

* fix rect index order

* fix MultiFace remapping with OffsetIntegers

* add moreMultiFace utils

* restore decompose(FaceType, faces, views)

* allow MultiFace -> LineFace conversion

* define Rect3 faces counterclockwise

* add more convenience types

* filter nothing attributes

* drop Base.Pairs for 1.6 compat

* Add depwarn in hasproperty too

* improve MultiFace show

* update Pyramid

* update Cylinder

* add MultiFace decompose

* fix Cylinder tests

* make OffsetInteger printing copyable

* update tests for Rect3 and normal gen

* fix remaining tests

* fix incorrect vertex index counter

* simplify merge of mixed Face types

* test merge(meshes)

* prototype swapping from MultiFace to FaceViews

* treat views in vertex index remapping + some fixes

* fix face type change

* clean up AbstractVertexFace

* extend FaceView interface

* update Cylinder, Pyramids

* declutter NgonFace prints

* update tests

* cleanup some test_broken

* switch to Dict

* fix tests

* remove shorthands

* export vertex_attributes and FaceView

* add center point to Circle to avoid shallow triangles

* make untesselated rect vertices counter-clockwise

* fix tests

* fix Cylinder face windig direction

* add `face_normals()` helepr function

* cleanup face_normals and normals a bit more

* update tests for Cylinder

* rename connectivity -> faces

* update docs (meshes, primitives, decompose, Point, Vec, Mat)

* add/update docstrings

* add quick test for face_normals()

* fix TetrahedronFace conversions

* restore volume functions

* fix tests

* add some Polygon tests

* test Pyramids

* test TetrahedronFace decomposition

* test and improve Mesh validation

* test Mesh inteface functions

* test decompose with views

* test and fix matrix det, inv, transpose, mat*vec

* fix tests

* cleanup normal gen and export face_normals

* add util for splitting meshes by views

* fix missing dot in range .+ idx

* improve performance of merge

* fix tests

* improve GeoInterface conversion performance

* switch back to NamedTuple for performance

* cleanup merge(meshes)

* test clear_faceviews with mesh.views

* fix missing import in docs examples

* add convert for arrays of meshes

* add function for removing duplicate faces

* update normal gen tests + fixes

- fix normal gen for varying face types
- fix normalization of face_normals

* remove time piracy

* bring back shorthand types

* restrict type in meshes to error earlier

* update precompiles

* autoconvert point dim in merge(meshes) instead of restricitng type

* add compat entry

* ignore unused PrecompileTools in 1.6, 1.7

* bring back old precompiles

* add convert target to orthogonal_vector

* revert triangulation changes of Circle

* revert to using StaticArrays

* avoid some invalidations (and fix get)

* fix stale instances due to AbstractVector

Apparently T[] is an AbstractVector here?

* use string interpolation in error to avoid invalidation from string *

* fix test

* export clear_faceviews & update FaceView docstring

* update type docstring

* add notes about views

* update Mesh docs

* add FaceView ref to Mesh docstring

* add brief section about extending decompose

* derive Point eltype when dimension is given

* reuse docstring

* fix docs?

* fix docs??
@SimonDanisch
Copy link
Member Author

I'm going to merge this, to clean up pending pull requests etc.
This doesn't mean it's 100% ready, I expect a bit more polish for the docs, and maybe a few more little clean ups once we use it more.

@SimonDanisch SimonDanisch merged commit 83f9abd into master Oct 17, 2024
8 checks passed
@SimonDanisch SimonDanisch deleted the sd/simple-mesh branch October 17, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants