mirror of https://github.com/CGAL/cgal
Update LCC demo to use a 'better' color for faces.
This commit is contained in:
parent
89f7e05dc6
commit
1e8ef8f05a
|
|
@ -38,7 +38,7 @@
|
|||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionLoad"/>
|
||||
<addaction name="actionSave"/>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuOperations">
|
||||
<property name="title">
|
||||
<string>&Operations</string>
|
||||
<string>Operations</string>
|
||||
</property>
|
||||
<addaction name="actionInsert_center_vertices"/>
|
||||
<addaction name="actionTriangulate_all_facets"/>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuCreations">
|
||||
<property name="title">
|
||||
<string>&Creations</string>
|
||||
<string>Creations</string>
|
||||
</property>
|
||||
<addaction name="actionCreate_cube"/>
|
||||
<addaction name="actionCreate3Cubes"/>
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
<string>View</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExtend_filled_volumes"/>
|
||||
|
|
@ -103,67 +103,67 @@
|
|||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionImportOFF">
|
||||
<property name="text">
|
||||
<string>&Import OFF</string>
|
||||
<string>Import OFF</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="text">
|
||||
<string>&Quit</string>
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSubdivide">
|
||||
<property name="text">
|
||||
<string>&Subdivide all volumes</string>
|
||||
<string>Subdivide all volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSubdivide_pqq">
|
||||
<property name="text">
|
||||
<string>&Subdivide all volumes - by Pqq</string>
|
||||
<string>Subdivide all volumes - by Pqq</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate3Cubes">
|
||||
<property name="text">
|
||||
<string>Create &3 cubes</string>
|
||||
<string>Create 3 cubes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionImport3DTDS">
|
||||
<property name="text">
|
||||
<string>Import 3D&TS</string>
|
||||
<string>Import 3DTS</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear">
|
||||
<property name="text">
|
||||
<string>&Clear</string>
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate2Volumes">
|
||||
<property name="text">
|
||||
<string>Create &2 volumes</string>
|
||||
<string>Create 2 volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDual_3">
|
||||
<property name="text">
|
||||
<string>&Dual</string>
|
||||
<string>Dual</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose_volume">
|
||||
<property name="text">
|
||||
<string>&Close all volumes</string>
|
||||
<string>Close all volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_cube">
|
||||
<property name="text">
|
||||
<string>Create &cube</string>
|
||||
<string>Create cube</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSew3_same_facets">
|
||||
<property name="text">
|
||||
<string>S&ew3 all same facets</string>
|
||||
<string>Sew3 all same facets</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_mesh">
|
||||
<property name="text">
|
||||
<string>Create &mesh</string>
|
||||
<string>Create mesh</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_Menger_Sponge">
|
||||
|
|
@ -173,22 +173,22 @@
|
|||
</action>
|
||||
<action name="actionRemove_filled_volumes">
|
||||
<property name="text">
|
||||
<string>&Remove volumes</string>
|
||||
<string>Remove volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTriangulate_all_facets">
|
||||
<property name="text">
|
||||
<string>&Triangulate facets</string>
|
||||
<string>Triangulate facets</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUnsew3_all">
|
||||
<property name="text">
|
||||
<string>&Unsew3 volumes</string>
|
||||
<string>Unsew3 volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInsideOut">
|
||||
<property name="text">
|
||||
<string>Reverse &orientation</string>
|
||||
<string>Reverse orientation</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVolume_list">
|
||||
|
|
@ -201,12 +201,12 @@
|
|||
</action>
|
||||
<action name="actionExtend_filled_volumes">
|
||||
<property name="text">
|
||||
<string>Extend &filled volumes</string>
|
||||
<string>Extend filled volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExtend_hidden_volumes">
|
||||
<property name="text">
|
||||
<string>Extend &hidden volumes</string>
|
||||
<string>Extend hidden volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCompute_Voronoi_3D">
|
||||
|
|
@ -216,7 +216,7 @@
|
|||
</action>
|
||||
<action name="actionMerge_all_volumes">
|
||||
<property name="text">
|
||||
<string>&Merge volumes</string>
|
||||
<string>Merge volumes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_Sierpinski_Carpet">
|
||||
|
|
@ -231,12 +231,12 @@
|
|||
</action>
|
||||
<action name="actionLoad">
|
||||
<property name="text">
|
||||
<string>&Load</string>
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionImportMoka">
|
||||
|
|
|
|||
|
|
@ -19,17 +19,32 @@ Viewer::Viewer(QWidget *parent)
|
|||
: Base(parent, m_graphic_buffer, ""),
|
||||
m_previous_scene_empty(true)
|
||||
{
|
||||
m_drawing_functor.volume_color=[](const LCC & alcc,
|
||||
Dart_const_handle dh)->CGAL::IO::Color
|
||||
{ return alcc.template info<3>(dh).color(); };
|
||||
m_drawing_functor.face_color=[](const LCC & alcc,
|
||||
Dart_const_descriptor dh)->CGAL::IO::Color
|
||||
{
|
||||
if(alcc.template is_free<3>(dh))
|
||||
{ return alcc.template info<3>(dh).color(); }
|
||||
|
||||
m_drawing_functor.colored_volume=[](const LCC &, Dart_const_handle)->bool
|
||||
if(!alcc.template info<3>(dh).is_visible() ||
|
||||
!alcc.template info<3>(dh).is_filled())
|
||||
{ return alcc.template info<3>(alcc.template beta<3>(dh)).color(); }
|
||||
|
||||
if(!alcc.template info<3>(alcc.template beta<3>(dh)).is_visible() ||
|
||||
!alcc.template info<3>(alcc.template beta<3>(dh)).is_filled())
|
||||
{ return alcc.template info<3>(dh).color(); }
|
||||
|
||||
const CGAL::IO::Color& c1=alcc.template info<3>(dh).color();
|
||||
const CGAL::IO::Color& c2=alcc.template info<3>(alcc.template beta<3>(dh)).color();
|
||||
return CGAL::IO::Color((c1[0]+c2[0])/2, (c1[1]+c2[1])/2, (c1[2]+c2[2])/2);
|
||||
};
|
||||
|
||||
m_drawing_functor.colored_face=[](const LCC &, Dart_const_descriptor)->bool
|
||||
{ return true; };
|
||||
|
||||
m_drawing_functor.draw_volume=[](const LCC & alcc, Dart_const_handle dh)->bool
|
||||
m_drawing_functor.draw_volume=[](const LCC & alcc, Dart_const_descriptor dh)->bool
|
||||
{ return alcc.template info<3>(dh).is_visible(); };
|
||||
|
||||
m_drawing_functor.volume_wireframe=[](const LCC& alcc, Dart_const_handle dh)->bool
|
||||
m_drawing_functor.volume_wireframe=[](const LCC& alcc, Dart_const_descriptor dh)->bool
|
||||
{ return !(alcc.template info<3>(dh).is_filled()); };
|
||||
}
|
||||
|
||||
|
|
@ -69,4 +84,5 @@ void Viewer::keyPressEvent(QKeyEvent *e)
|
|||
Base::keyPressEvent(e);
|
||||
}
|
||||
|
||||
QString Viewer::helpString() const { return Base::helpString("LCC Demo"); }
|
||||
QString Viewer::helpString() const
|
||||
{ return Base::helpString("LCC Demo"); }
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ public Q_SLOTS:
|
|||
|
||||
private:
|
||||
CGAL::Drawing_functor_with_volume<LCC,
|
||||
Dart_const_handle,
|
||||
Dart_const_handle,
|
||||
Dart_const_handle,
|
||||
Dart_const_handle> m_drawing_functor;
|
||||
Dart_const_descriptor,
|
||||
Dart_const_descriptor,
|
||||
Dart_const_descriptor,
|
||||
Dart_const_descriptor> m_drawing_functor;
|
||||
CGAL::Graphic_buffer<float> m_graphic_buffer;
|
||||
Scene* scene;
|
||||
bool m_previous_scene_empty;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void compute_edge(typename LCC::Dart_const_handle dh, const LCC *lcc,
|
|||
|
||||
const typename LCC::Point& p1=lcc->point(dh);
|
||||
typename LCC::Dart_const_handle d2=lcc->other_extremity(dh);
|
||||
if (d2!=nullptr)
|
||||
if (d2!=LCC::null_descriptor)
|
||||
{
|
||||
if (m_drawing_functor.colored_edge(*lcc, dh))
|
||||
{
|
||||
|
|
@ -173,7 +173,9 @@ void compute_elements(const LCC *lcc,
|
|||
lcc->is_marked(itv, oriented_mark) &&
|
||||
m_drawing_functor.draw_face(*lcc, itv))
|
||||
{
|
||||
if (!m_drawing_functor.volume_wireframe(*lcc, itv) &&
|
||||
if ((!m_drawing_functor.volume_wireframe(*lcc, itv) ||
|
||||
(!lcc->template is_free<3>(itv) &&
|
||||
!m_drawing_functor.volume_wireframe(*lcc, lcc->template beta<3>(itv)))) &&
|
||||
!m_drawing_functor.face_wireframe(*lcc, itv))
|
||||
{ compute_face(itv, it, lcc, m_drawing_functor, graphic_buffer); }
|
||||
for(typename LCC::template Dart_of_cell_basic_range<2>::const_iterator
|
||||
|
|
@ -240,7 +242,8 @@ void add_in_graphic_buffer(const CGAL_LCC_TYPE &alcc,
|
|||
CGAL::Graphic_buffer<BufferType> &graphic_buffer,
|
||||
const DrawingFunctor &m_drawing_functor)
|
||||
{
|
||||
draw_function_for_lcc::compute_elements(&alcc, graphic_buffer, m_drawing_functor);
|
||||
draw_function_for_lcc::compute_elements(static_cast<const Refs*>(&alcc),
|
||||
graphic_buffer, m_drawing_functor);
|
||||
}
|
||||
|
||||
// add_in_graphic_buffer: to add a LCC in the given graphic buffer, without a
|
||||
|
|
|
|||
Loading…
Reference in New Issue