Skip to content

Conversation

@ThomasCartier
Copy link

Updated the missing functions since last C api update.
I didn't touch sfcgal-sys.

I also marked some functions as deprecated, to follow the sfcgal guideline.

To ease the review, I separated the newly added sfcgal_ function in their own block.
The rust methods were grouped below the "For review" to ease the double check.

Some new functions were not decorated with pre checks: this is intentional because it would require more work. I may do that later.

Please feel free to point errors I could make. I will correct them. :)

@mthh
Copy link
Owner

mthh commented Jul 15, 2025

Thanks for the PR!
I'm starting to review it. I also pushed changes to the CI workflows in order to use SFCGAL 2.1.0, can you catch up with the master branch with a rebase please?

@ThomasCartier
Copy link
Author

Did it! Is that ok for you?

@mthh
Copy link
Owner

mthh commented Jul 15, 2025

Thanks! I would have preferred a rebase (to avoid having a merge commit, it keeps a cleaner commit history) but no worries :)

@ThomasCartier
Copy link
Author

I will be in front of my computer in 1 hour will correct that!

@ThomasCartier
Copy link
Author

I am not very comfy with git commands, not sure I accessed your request ( I would like to, I use VSCode, if you know more, and I did wrong, please do not hesitate)

@mthh
Copy link
Owner

mthh commented Jul 15, 2025

I don't think you've done what's necessary because I can still see the merge commit.

If you haven't added anything (locally) since the merge commit on your branch, I think you can do the following in a terminal:

# Check the last commit is the merge commit
git log -n 1
# You should see the commit info, with the message
# "Merge remote-tracking branch 'original/master'"
# Otherwise, do not continue to follow the instructions below!

# Delete the last commit (the merge commit)
git reset --hard HEAD^

# Add this repo as a remote called 'upstream'
git remote add upstream https://github.com/mthh/sfcgal-rs

# Fetch the latest changes from this repo
git fetch upstream

# Rebase your branch onto the latest master branch from this repo
git rebase upstream/master

# Push your updated branch to your fork
# (--force/--force-with-lease is needed to overwrite the history)
git push --force-with-lease

Note that these instructions are based on what I see (on GitHub) of the state of the master branch from which you made the PR (but I don't know what you tried to do in your last post, I don't see any changes on GitHub).

If you don't feel confortable doing this (or if you have new local commits, or unstaged changes), really, no worries, I could always squash the commits when I accept this PR.

@ThomasCartier
Copy link
Author

ThomasCartier commented Jul 16, 2025

Ok I just did your listed actions. Looks like it did it :) I am not sure if it's possible to do it directly with the VSCode options though (GUI only, without using the terminal).

Maybe next time I should follow up on the different branch "update functions" instead of working on the main branch..

@mthh
Copy link
Owner

mthh commented Jul 17, 2025

Ok I just did your listed actions. Looks like it did it :)

Great, thanks :)
Rebasing against the main upstream branch is a fairly common request (but I've never used the Git features built into IDEs, I only use it from the command line so I don't have much idea how to do it).


// For review
use sfcgal_sys::{
sfcgal_geometry_alpha_wrapping_3d, sfcgal_geometry_as_stl, sfcgal_geometry_as_stl_file,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is running against the latest stable sfcgal release (2.1.0) which doesn't seem to contain the following functions (sfcgal_sys::sfcgal_geometry_as_stl, sfcgal_sys::sfcgal_geometry_as_stl_file, sfcgal_sys::sfcgal_geometry_get_geometry_n, sfcgal_sys::sfcgal_geometry_get_geometry_n, sfcgal_sys::sfcgal_geometry_set_geometry_n).
I tested locally (and checked in the source distribution of sfcgal 2.1.0) and I can't find them either (although they are in the documentation https://sfcgal.gitlab.io/SFCGAL/API/group__capi/, which is probably based on the current source tree of sfcgal).

// For review
use sfcgal_sys::{
sfcgal_geometry_alpha_wrapping_3d, sfcgal_geometry_as_stl, sfcgal_geometry_as_stl_file,
sfcgal_geometry_boundary, sfcgal_geometry_centroid, sfcgal_geometry_centroid,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated sfcgal_geometry_centroid should be removed.

SFCGeometry::new_from_raw(converted, true)
}

// For review
Copy link
Owner

@mthh mthh Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added function looks good to me. It is just lacking documentation for now but I guess you were planning to add documentation to them? Otherwise I could accept it as it and do it myself :)

Concerning the functions that depend on the new sfcgal function there weren't included in 2.1.0 (namely sfcgal_sys::sfcgal_geometry_as_stl, sfcgal_sys::sfcgal_geometry_as_stl_file, sfcgal_sys::sfcgal_geometry_get_geometry_n, sfcgal_sys::sfcgal_geometry_get_geometry_n, sfcgal_sys::sfcgal_geometry_set_geometry_n), you can just comment the code and the imports and we will add them when 2.2.0 will be released ? (or you can remove them totally from this PR, and create a new draft PR for them, but it's a bit of extra work that's not necessarily necessary).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, I probably pulled the trigger too fast, many functions are planned for 2.2.0 (that will be less work for the future)! I will double check that, comment the offenders and resubmit! :)

@mthh
Copy link
Owner

mthh commented Jul 17, 2025

Thanks for this new contributions :)

It's not directly concerning this PR, but as you often contribute new features (and as there's a notable difference here between the latest stable version and the development version), I wanted to inform you that I may try to integrate some form of versioning into the next version of sfcgal-sys / sfcgal-rs (a bit like what GEOS bindings do in Rust) using feature flags, allowing users to build the library against the version of SFCGAL they own (like 2.0.0, 2.1.0, latest dev version).
This requires a bit of work (but allows greater flexibility, and we could easily have a version designed to use the latest SFCGAL dev features). I haven't got around to it yet, perhaps during the summer 😅

@ThomasCartier
Copy link
Author

I was thinking about it while separating the new functions, that would be much clearer to roam in the code! Excellent idea! 😉

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.

2 participants