Problem with automatic normal generation - mdbc

Hi,

I want to make a hopper geometry as shown below. The created boundary surface is inside the actual boundary particles.

Below is a view of the boundary surface itself. When I check the automatic generated normals. It appears that only half the surface has corrected normals. The other half (marked in blue) has normals (0,0,0). In addition, there are some bands of non-zero normals but the directions are not correct. I cannot figure out what was the problem. Please help me. Thanks.!

Below is the Def.xml code:

<setfrdrawmode auto="false" />

               <!-- Draw surfaces without particles -->

               <setactive drawpoints="false" />

               <setmkbound mk="9"/>

               <drawquadri> # fronttop

                  <point x="0.64" y="0.2" z="0"/>

                  <point x="0.64" y="0.2" z="0.60"/>

                  <point x="0.02" y="0.2" z="0.6"/>

                  <point x="0.02" y="0.2" z="0"/>

               </drawquadri>

               <drawquadri> # backtop

                  <point x="0.64" y="0.02" z="0"/>

                  <point x="0.64" y="0.02" z="0.60"/>

                  <point x="0.02" y="0.02" z="0.6"/>

                  <point x="0.02" y="0.02" z="0"/>

               </drawquadri>

               <drawtrianglesstrip> # frontbottom

                  <point x="0.317" y="0.2" z="-0.515"/>

                  <point x="0.343" y="0.2" z="-0.515"/>

                  <point x="0.02" y="0.2" z="0"/>

                  <point x="0.64" y="0.2" z="0"/>

               </drawtrianglesstrip>

               <drawtrianglesstrip> # backbottom

                  <point x="0.317" y="0.02" z="-0.515"/>

                  <point x="0.343" y="0.02" z="-0.515"/>

                  <point x="0.02" y="0.02" z="0"/>

                  <point x="0.64" y="0.02" z="0"/>

               </drawtrianglesstrip>

               <drawextrude closed="false"> # sideleft

                  <point x="0.64" y="0.02" z="0.6"/>

                  <point x="0.64" y="0.02" z="0"/>

                  <point x="0.343" y="0.02" z="-0.515"/>

                  <extrude x="0" y="0.18" z="0" />

               </drawextrude>

               <drawextrude closed="false"> # sideright

                  <point x="0.02" y="0.02" z="0.6"/>

                  <point x="0.02" y="0.02" z="0"/>

                  <point x="0.317" y="0.02" z="-0.515"/>

                  <extrude x="0" y="0.18" z="0" />

               </drawextrude>

               <shapeout file="hdp" reset="true" />

               <!-- Draw surfaces with particles -->

               <matrixreset />

               <setfrdrawmode auto="true" />

               <setactive drawpoints="true" />

                   <move x="0.351" y="0.01" z="-0.516" />

                   <rotate ang="-29.999999999999996" x="-0.0" y="1.0" z="-0.0" />

                   <setmkbound mk="0" />

                   <setdrawmode mode="full" />

                   <drawbox objname="rightslide">

                       <boxfill>solid</boxfill>

                       <point x="0" y="0" z="0" />

                       <size x="0.01" y="0.2" z="0.6" />

                   </drawbox>

                   <matrixreset />

                   <move x="0.3" y="0.01" z="-0.52" />

                   <rotate ang="-29.999999999999996" x="-0.0" y="-1.0" z="-0.0" />

                   <setmkbound mk="1" />

                   <setdrawmode mode="full" />

                   <drawbox objname="leftslide">

                       <boxfill>solid</boxfill>

                       <point x="0" y="0" z="0" />

                       <size x="0.01" y="0.2" z="0.6" />

                   </drawbox>

                   <matrixreset />

                   <setmkbound mk="4" />

                   <setdrawmode mode="full" />

                   <drawbox objname="backtop">

                       <boxfill>solid</boxfill>

                       <point x="0.0" y="0.21" z="-0.52" />

                       <size x="0.66" y="0.01" z="1.12" />

                   </drawbox>

                   <setmkbound mk="5" />

                   <setdrawmode mode="full" />

                   <drawbox objname="righttop">

                       <boxfill>solid</boxfill>

                       <point x="0.65" y="0.01" z="0.0" />

                       <size x="0.01" y="0.2" z="0.6" />

                   </drawbox>

                   <setmkbound mk="6" />

                   <setdrawmode mode="full" />

                   <drawbox objname="lefttop">

                       <boxfill>solid</boxfill>

                       <point x="0.0" y="0.01" z="0.0" />

                       <size x="0.01" y="0.2" z="0.6" />

                   </drawbox>

                   <setmkbound mk="7" />

                   <setdrawmode mode="full" />

                   <drawbox objname="fronttop">

                       <boxfill>solid</boxfill>

                       <point x="0.0" y="0.0" z="-0.52" />

                       <size x="0.66" y="0.01" z="1.12" />

                   </drawbox>

                   <setmkbound mk="8" />

                   <setdrawmode mode="full" />

                   <drawbox objname="base">

                       <boxfill>solid</boxfill>

                       <point x="0.28" y="0.0" z="-0.535" />

                       <size x="0.1" y="0.22" z="0.01" />

                   </drawbox>

                   <setmkfluid mk="0" />

               <fillbox x="0.4" y="0.1" z="-0.19">

               <modefill>void</modefill>

               <point x="-0.1" y="-0.1" z="-0.54" />

               <size x="0.8" y="0.5" z="0.65" />

               </fillbox>

                   <shapeout file="" />

.....................

      <normals>

           <distanceh value="2.0" />

           <geometryfile file="hopper_0103_3_hdp_Actual.vtk" />

           <svshapes value="1" />

       </normals>

......................

Comments

  • Never mind. I figured out the problem.

    The sequence of the points in drawing is critical. For example, the original code was:


                   <drawtrianglesstrip> # backbottom

                      <point x="0.317" y="0.02" z="-0.515"/>

                      <point x="0.343" y="0.02" z="-0.515"/>

                      <point x="0.02" y="0.02" z="0"/>

                      <point x="0.64" y="0.02" z="0"/>

                   </drawtrianglesstrip>


    By changing the code to:

                   <drawtrianglesstrip> # backbottom

                      <point x="0.317" y="0.02" z="-0.515"/>

                      <point x="0.64" y="0.02" z="0"/>

                      <point x="0.02" y="0.02" z="0"/>

                      <point x="0.343" y="0.02" z="-0.515"/>

                   </drawtrianglesstrip>

    The normal can now be applied correctly.

  • Great job!

    I believe it matters because the way the triangle is drawn determines the "Normal" of the resulting face. As far as I remember it is therefore it is important to stay consistent with either using a clock-wise or counter clock wise ordering of triangular points.

    Kind regards

Sign In or Register to comment.

Debug Trace

Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Hi,...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(197): Gdn_Format::to('[{"insert":"Hi,...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2495', 'problem-with-au...', '')
#6 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#7 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#8 {main}
Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Hi,...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"Hi,...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/discussion.php(89): formatBody(Object(stdClass))
#6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(31): include('/var/www/forums...')
#7 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...')
#8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false)
#9 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender()
#10 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array)
#11 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2495', 'problem-with-au...', '')
#12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#13 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#14 {main}
Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Nev...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"Nev...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(170): formatBody(Object(stdClass))
#6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/comments.php(19): writeComment(Object(stdClass), Object(DiscussionController), Object(Gdn_Session), 1)
#7 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(53): include('/var/www/forums...')
#8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...')
#9 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false)
#10 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender()
#11 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array)
#12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2495', 'problem-with-au...', '')
#13 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#14 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#15 {main}
Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Gre...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"Gre...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(170): formatBody(Object(stdClass))
#6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/comments.php(19): writeComment(Object(stdClass), Object(DiscussionController), Object(Gdn_Session), 2)
#7 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(53): include('/var/www/forums...')
#8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...')
#9 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false)
#10 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender()
#11 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array)
#12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2495', 'problem-with-au...', '')
#13 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#14 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#15 {main}