Changeset 27888f for src


Ignore:
Timestamp:
Sep 19, 2013, 8:24:28 PM (11 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:
4d4caf
Parents:
00eda9
git-author:
Frederik Heber <heber@…> (08/31/13 02:02:15)
git-committer:
Frederik Heber <heber@…> (09/19/13 20:24:28)
Message:

Using Normals from tesselated surface instead of from Shapes.

  • getNormal() takes veeeery long with deeply nested Shape trees.
  • added Tesselation::getNormal() which uses TriangleIntersectionList.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Tesselation/tesselation.cpp

    r00eda9 r27888f  
    26022602}
    26032603
     2604Vector Tesselation::getNormal(const Vector &Point, const LinkedCell_deprecated* const LC) const
     2605{
     2606  TriangleIntersectionList Intersections(Point, this, LC);
     2607  BoundaryTriangleSet *triangle = Intersections.GetClosestTriangle();
     2608  if (triangle != NULL) {
     2609    return triangle->NormalVector;
     2610  } else
     2611    return zeroVec;
     2612}
     2613
    26042614/** Returns the distance to the surface given by the tesselation.
    26052615 * Calls FindClosestTriangleToVector() and checks whether the resulting triangle's BoundaryTriangleSet#NormalVector points
  • src/Tesselation/tesselation.hpp

    r00eda9 r27888f  
    124124    BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell_deprecated* LC) const;
    125125    bool IsInnerPoint(const Vector &Point, const LinkedCell_deprecated* const LC) const;
     126    Vector getNormal(const Vector &Point, const LinkedCell_deprecated* const LC) const;
    126127    double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
    127128    double GetDistanceToSurface(const Vector &Point, const LinkedCell_deprecated* const LC) const;
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp

    r00eda9 r27888f  
    5151
    5252#include "Shapes/Shape.hpp"
     53#include "Shapes/ShapeFactory.hpp"
    5354#include "LinearAlgebra/Vector.hpp"
    5455#include "LinkedCell/PointCloudAdaptor.hpp"
     
    8990  }
    9091
    91   // Fill the points into a Qt geometry.
    92   QGeometryData geo;
    93   for(size_t i=0;i<points.size();++i){
    94     // add data to the primitive
    95     geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2]));
    96     Vector n = shape.getNormal(points[i]);
    97     geo.appendNormal(QVector3D(n[0], n[1], n[2]));
    98     geo.appendColor(QColor(1, 1, 1, 1));
    99     geo.appendTexCoord(QVector2D(0, 0));
    100   }
    101 
    10292  // Tesselate the points.
    10393  Tesselation *T = new Tesselation;
    10494  PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList");
    10595  (*T)(cloud, minradius);
     96
     97  // Fill the points into a Qt geometry.
     98  QGeometryData geo;
     99  LinkedCell_deprecated LinkedList(cloud, minradius);
     100  std::vector<Vector> normals;
     101  normals.resize(points.size(), zeroVec);
     102  for(size_t i=0;i<points.size();++i){
     103    // add data to the primitive
     104    geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2]));
     105    if (ShapeFactory::getInstance().isSimpleShape(shape.getType()))
     106      normals[i] = shape.getNormal(points[i]);
     107    else
     108      normals[i] = T->getNormal(points[i], &LinkedList);
     109    geo.appendNormal(QVector3D(normals[i][0], normals[i][1], normals[i][2]));
     110    geo.appendColor(QColor(1, 1, 1, 1));
     111    geo.appendTexCoord(QVector2D(0, 0));
     112  }
    106113
    107114  // Fill the tesselated triangles into the geometry.
     
    114121    Vector cross = points[v[1]] - points[v[0]];
    115122    cross.VectorProduct(points[v[2]] - points[v[0]]);
    116     if (cross.ScalarProduct(shape.getNormal(points[v[0]]) + shape.getNormal(points[v[1]]) + shape.getNormal(points[v[2]])) > 0)
     123    if (cross.ScalarProduct(normals[v[0]] + normals[v[1]] + normals[v[2]]) > 0)
    117124      geo.appendIndices(v[0], v[1], v[2]);
    118125    else
Note: See TracChangeset for help on using the changeset viewer.