Git Product home page Git Product logo

Comments (10)

dlegland avatar dlegland commented on May 27, 2024 1

Good to know it works fine!

I agree about output arguments, I was also wondering about what was the best choice.
It may also depend on usage; I usually focus on closed meshes, so closed polygons as first output better fits me!

Another option is to gather all curves (open and closed) in a single cell array, and additionnally provide a logical array the same size as the curve array indicating whether the curve is closed or open. This will be also consistent with previous syntax.

Something like this:

[allCurves, closedFlag] = intersectPlaneMesh(plane, vertices, faces);
drawPolygon3d(allCurves(closedFlag), 'r');
drawPolyline3d(allCurves(~closedFlag), 'b');

Best,

from matgeom.

oqilipo avatar oqilipo commented on May 27, 2024 1

Something like this:

[allCurves, closedFlag] = intersectPlaneMesh(plane, vertices, faces);
drawPolygon3d(allCurves(closedFlag), 'r');
drawPolyline3d(allCurves(~closedFlag), 'b');

Sounds good!

from matgeom.

oqilipo avatar oqilipo commented on May 27, 2024 1

Works great. Thank you.

I've also added the function clipMeshByPlane.m
grafik

from matgeom.

dlegland avatar dlegland commented on May 27, 2024

Hi,

yes, I think it is possible (I mean the algorithm can be extended to manage the case of open meshes. I'll investigate this.

from matgeom.

zfshmn avatar zfshmn commented on May 27, 2024

Hi David,
Thanks for all of your work on the Geom3D toolbox. I was wondering if there has been any updates for allowing intersecting a plane with an open mesh? This feature would greatly help my analysis
Thank you!
Zach

from matgeom.

dlegland avatar dlegland commented on May 27, 2024

Hi,
unfortunately not... The problem is the iteration over edge/vertices of the intersection. I do not know for the moment how to start iteration from extremities.
Still on the TODO list...

from matgeom.

zfshmn avatar zfshmn commented on May 27, 2024

Thank you for the update. I'll keep tinkering with it too and look forward to future updates if you figure it out.
PS for the requested functions list: I'm looking to intersect an open mesh with plane to then mirror the mesh across that plane and add in vertices & faces at the mirror plane
Thanks again!

from matgeom.

dlegland avatar dlegland commented on May 27, 2024

well, better later than never, I finally implemented management of mesh-plane intersection for open meshes (commit d2c03de)! The new syntax is as follow:

[closedCurves, openCurves] = intersectPlaneMesh(Plane, vertices, faces);

It returns closed polygons in first output argument (as before), and open polylines in second output argument. That way the function does not break existing code.

Hope you will find it useful...

from matgeom.

oqilipo avatar oqilipo commented on May 27, 2024

Great, thank you! I used it for a few test cases and it works fine.

However, I'm not quite sure if the output arguments are optimal. Often one will need something like:

if isempty(closedCurves)
    curve = openCurves;
else
    curve = closedCurves;
end

One could use a 'legacy' flag. I think that the way how they do it in MATLAB's build-in functions.
See https://www.mathworks.com/help/matlab/ref/double.unique.html for example.

Kind regards

from matgeom.

dlegland avatar dlegland commented on May 27, 2024

Just comitted the modification: b897628

from matgeom.

Related Issues (20)

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.