Comments (5)
Hi, CinoLib is meant to provide basic ingredients to build research oriented software prototypes. To this end, the functionalities you mention are not strictly contained in the library, but all the ingredients are available, so that you can implement them with a few lines of code. As a representative example, I am attaching at the bottom of this message a simple implementation of the mouse_click callback which would allow you to show/hide a selected element from a volumetric mesh such as the one shown in the picture above with CTRL+click and SHIFT+click. To try it out you can literally copy/paste such code in the library examples, and play it.
A few extra notes on this tool:
-
the {vert/edge/face/poly}_pick facilities are implemented in the most trivial possible way, so they run in O(n) with n being the number of elements. This is usually OK for user interaction and medium sized meshes. Should you need more speed, you can always use a cinolib::Octree and the ray intersection query, obtaining more accurate item selections at a much faster speed.
-
the selection of all the elements inside a box drawn in the canvas could be easily generated starting from my example. In that case you should implement the mouse_press/mouse_release callbacks for the generation of the wanted rectangular selection. The rest is not significantly different from the code I am sharing with you
Good luck!
gui.callback_mouse_press = [&](GLcanvas *c, QMouseEvent *e)
{
if(e->modifiers() == Qt::ControlModifier)
{
vec3d p;
vec2i click(e->x(), e->y());
if (c->unproject(click, p))
{
uint pid = m.pick_poly(p);
m.poly_data(pid).visible = false;
m.updateGL();
c->updateGL();
}
}
else if(e->modifiers() == Qt::ShiftModifier)
{
vec3d p;
vec2i click(e->x(), e->y());
if(c->unproject(click, p))
{
uint fid = m.pick_face(p);
for(uint pid : m.adj_f2p(fid)) m.poly_data(pid).visible = true;
m.updateGL();
c->updateGL();
}
}
};
from cinolib.
I see!
Thank you very much!!!
from cinolib.
Hello @mlivesu
could you please give an up-to-date sampel code for doing this without Qt (but GLFW instead) ?
I tried this, but the 'visible' attribute is no longer available:
from cinolib.
I found this:
m.poly_data(pid).flags[HIDDEN] = false;
and it seems to work.
But I am now wondering how the CTRL key is supposed to work: it seems to set tets as visible when selecting a tet witH CTRL key, but I don't know how it could work..
from cinolib.
Hi, sorry for the late reply but I was on vacation :)
As you noticed some things have changed since my reply to this issue back in 2019. In the current version of cinolib manual selection facilities to show/hide elements have been incorporated in the VolumeMeshControls. More specifically, if you run the tetmesh viewer example and press the TAB key to show the side bar, you will notice that there is a menu item called Manual Digging
. If you expand this, you can select an action between dig
, undig
, isolate
. All these options are controlled with SHIFT + mouse click on a mesh element and serve to: hide an element (dig
), show an element (undig
) or to hide all the elements that are incident to a selected element (isolate
).
I hope this will help you out!
Marco
from cinolib.
Related Issues (20)
- Is it possible to offset a mesh preserving its sharp edges? HOT 6
- How to generate a cinolib? HOT 2
- Cut a volume mesh based on embedded level set HOT 15
- no member named 'update_hex_quality' HOT 3
- OpenGL rendering: soft shadows HOT 3
- How to use remesh_Botsch_Kobbelt_2004 without gl HOT 3
- Orient a closed surface mesh HOT 4
- Custom data in Tetmesh HOT 1
- All-hexahedral meshing? HOT 1
- Shadow casting question HOT 5
- Embed a polyline into a mesh HOT 4
- error when run sliced_CLI_loader HOT 1
- CMD + click ,What button is cmd in surface_painter project HOT 1
- Link errors HOT 1
- information HOT 8
- Imgui control hidden HOT 2
- How to implement algorithms such as QEM HOT 2
- Support for Semantic Versioning HOT 3
- intersection when rendering a .mesh file HOT 5
- can we train an AI assisatnt for CAX? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinolib.