Ignore:
Timestamp:
Apr 17, 2013, 6:56:32 PM (12 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
ba6b5c
Parents:
708277
git-author:
Frederik Heber <heber@…> (03/18/13 18:40:52)
git-committer:
Frederik Heber <heber@…> (04/17/13 18:56:32)
Message:

FIX: GLMoleculeObject_shape did tesselate with fixed radius.

  • this radius is too small for large shapes (e.g. sphere with radius 20).
  • we now approximate the radius estimated from the surface area of the shape.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp

    r708277 r691318  
    6363QGLSceneNode *createShapeMesh(Shape &shape, QObject *parent)
    6464{
     65  size_t NumPointsonSurface = 200;
     66  // guess the surface area which divided by 200 determines rolling sphere's size
     67  const double surfacearea = shape.getSurfaceArea();
     68  const size_t EstimatedNumberTriangles = NumPointsonSurface*1;
     69  const double MeanAreaPerTriangle = surfacearea/((double)EstimatedNumberTriangles);
     70  // assume two triangles to form a square and take its diameter as the radius
     71  double minradius = sqrt(2. * 2.*MeanAreaPerTriangle);
     72  LOG(3, "DEBUG: Surface area is " << surfacearea << ", minradius is " << minradius << ".");
     73  if (minradius < 1.)
     74    minradius = 1.;
     75  LOG(2, "DEBUG: Tesselating shape " << shape.getName() << " with sphere of radius " << minradius << ".");
     76
    6577  // Create some points on our shape.
    66   std::vector<Vector> points = shape.getHomogeneousPointsOnSurface(200);
     78  std::vector<Vector> points = shape.getHomogeneousPointsOnSurface(NumPointsonSurface);
    6779
    6880  // Fill the points into a tesselate-able container.
    6981  TesselPointSTLList Corners;
    70   for (int i=0;i<points.size();i++){
     82  for (size_t i=0;i<points.size();++i){
    7183    TesselPoint *Walker = new TesselPoint;
    7284    Walker->setPosition(points[i]);
     
    7890  // Fill the points into a Qt geometry.
    7991  QGeometryData geo;
    80   for(int i=0;i<points.size();i++){
     92  for(size_t i=0;i<points.size();++i){
    8193    // add data to the primitive
    8294    geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2]));
     
    90102  Tesselation *T = new Tesselation;
    91103  PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList");
    92   (*T)(cloud, 2);
     104  (*T)(cloud, minradius);
    93105
    94106  // Fill the tesselated triangles into the geometry.
    95107  for (TriangleMap::const_iterator runner = T->TrianglesOnBoundary.begin(); runner != T->TrianglesOnBoundary.end(); runner++) {
    96108    int v[3];
    97     for (int i=0; i<3; i++)
     109    for (size_t i=0; i<3; ++i)
    98110      v[i] = runner->second->endpoints[i]->node->getNr();
    99111
Note: See TracChangeset for help on using the changeset viewer.