Skip to content

Comments

Add swept extrusion#6317

Draft
sloriot wants to merge 5 commits intoCGAL:mainfrom
sloriot:PMP-swept_extrusion
Draft

Add swept extrusion#6317
sloriot wants to merge 5 commits intoCGAL:mainfrom
sloriot:PMP-swept_extrusion

Conversation

@sloriot
Copy link
Member

@sloriot sloriot commented Feb 11, 2022

fixes #6292

works only with surface mesh and modify input
@sancelot
Copy link

sancelot commented Mar 2, 2022

I tried it , I had this compilation error
E:/WORKSPACE/cgal/Polygon_mesh_processing/examples/Polygon_mesh_processing/create_bended_cylinder.cpp:52:8: error: 'sweep_extrude' is not a member of 'PMP'
52 | PMP::sweep_extrude(mesh, guide, out);
| ^~~~~~~~~~~~~

@sloriot
Copy link
Member Author

sloriot commented Mar 2, 2022

No idea how you compiled it but this PR modifies 2 CGAL headers, one of them contains that function.

@sancelot
Copy link

sancelot commented Mar 3, 2022

I compiled using msys2 mingw64 compiler.

Removing this line compiles.

@sloriot
Copy link
Member Author

sloriot commented Mar 3, 2022

I mean, you either need to add the modified headers in the compilation unit (before those of the release) or use the branch to compile the example.

@sancelot
Copy link

sancelot commented Mar 3, 2022

I am using your branch ... this is why I don't really understand ...

@sloriot
Copy link
Member Author

sloriot commented Mar 3, 2022

The way I would debug that is to put a typo in the header file you think is used and see if the compilation fails at that point. You can also grep CGAL_DIR in CMakeCache.txt, ...

@sancelot
Copy link

sancelot commented Mar 3, 2022

OK. I found the pb, it was using a conflicting cgal header installed in the system.
Thanks.

@MaelRL MaelRL added Not yet approved The feature or pull-request has not yet been approved. CHANGES.md not updated labels Mar 28, 2022
@FuzhangHe
Copy link

Hallo Sloriot,

Firstly, thank you for the sweep function, it is really useful.

In my case, it is difficult to calculate the guidelines. But I know the start face mesh, the rotation angle, and translation, so I can calculate the end face mesh. Is there any method to construct a surface mesh with the start face mesh and end face mesh?
I think it is the same as sweep, but not with guideline.

@sloriot
Copy link
Member Author

sloriot commented Feb 3, 2023

@FuzhangHe if it is only a translation, I guess you can sample le translation and interpolate the rotation to get something smooth.

@FuzhangHe
Copy link

Hello, Sloriot,

Thank you for the quick reply.
For my case, it is only a simple rotation:

I have tried the following code with the PMP::sweep_extrude function:

  Mesh mesh;

  // Add the points as vertices
  vertex_descriptor u = mesh.add_vertex(K::Point_3(0, 1, 0));
  vertex_descriptor v = mesh.add_vertex(K::Point_3(0, 2, 0));
  vertex_descriptor w = mesh.add_vertex(K::Point_3(0, 2, 1));
  vertex_descriptor x = mesh.add_vertex(K::Point_3(0, 1, 1));
  face_descriptor f = mesh.add_face(u, v, w, x);

  std::vector<Point_3> guide;

  for (int i=0; i<7; ++i)
    guide.push_back(Point_3(2*std::sin(2 * CGAL_PI / 24 * i), 2 * std::cos(2 * CGAL_PI / 24 * i),  0));

The result is shown in the following foto. It can be seen, that it has been rotated slightly more than 90°. When I refine the rotation angle, the result will be better.
image

To my question:
I know how to interpolate the rotation of a face mesh, but I do not know how to connect the face meshes to a new surface mesh. Should I do something like the extrude_impl::create_strip as in the extrude.h ?

@sloriot
Copy link
Member Author

sloriot commented Feb 6, 2023

You should indeed create intermediate contours stored in the code in current_hedges and incrementally add strips using extrude_impl::create_strip(). Look around https://github.com/CGAL/cgal/pull/6317/files#diff-55f2604e6a010faeeb37e6e4ce1e05b11d71cfdcc12e35c3aebbbdd911c644cdR500

@MaelRL MaelRL added this to the 5.7-beta milestone Mar 23, 2023
@janetournois janetournois modified the milestones: 6.0-beta, 6.1-beta May 16, 2024
@MaelRL MaelRL modified the milestones: 6.1-beta, 6.2-beta Mar 17, 2025
@sloriot sloriot changed the base branch from master to main September 16, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHANGES.md not updated Not yet approved The feature or pull-request has not yet been approved. Pkg::PMP Small feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mesh Pipe

5 participants