Changeset 013ad57
- Timestamp:
- Nov 26, 2009, 11:36:44 AM (16 years ago)
- Children:
- a68d44
- Parents:
- 3aa635
- Location:
- molecuilder/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/tesselation.cpp
r3aa635 r013ad57 42 42 { 43 43 Info FunctionInfo(__func__); 44 Log() << Verbose(1) << "Adding at " << *(node->node)<< endl;44 Log() << Verbose(1) << "Adding Node " << *Walker << endl; 45 45 }; 46 46 … … 593 593 { 594 594 Info FunctionInfo(__func__); 595 ost << "[" << ( Name) << "|" << this << "]";595 ost << "[" << (nr) << "|" << this << "]"; 596 596 return ost; 597 597 }; … … 2075 2075 Info FunctionInfo(__func__); 2076 2076 Vector Center; 2077 BoundaryLineSet *BaseLine = CandidateLine.BaseLine; 2078 2079 // go through all candidates (in degenerate n-nodes case we may have to add multiple triangles) 2080 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) { 2081 Log() << Verbose(2) << "BaseLine is :" << *(BaseLine) << " with current candidate " << *(*Runner) << "." << endl; 2077 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node; 2078 2079 // fill the set of neighbours 2080 Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2081 Center.SubtractVector(TurningPoint->node); 2082 set<TesselPoint*> SetOfNeighbours; 2083 SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node); 2084 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) 2085 SetOfNeighbours.insert(*Runner); 2086 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center); 2087 2088 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) 2089 TesselPointList::iterator Runner = connectedClosestPoints->begin(); 2090 TesselPointList::iterator Sprinter = Runner; 2091 Sprinter++; 2092 while(Sprinter != connectedClosestPoints->end()) { 2082 2093 // add the points 2083 AddTesselationPoint( BaseLine->endpoints[0]->node, 0);2084 AddTesselationPoint( BaseLine->endpoints[1]->node, 1);2085 AddTesselationPoint((* Runner), 2);2094 AddTesselationPoint(TurningPoint, 0); 2095 AddTesselationPoint((*Runner), 1); 2096 AddTesselationPoint((*Sprinter), 2); 2086 2097 2087 2098 Center.CopyVector(&CandidateLine.OptCenter); 2088 2099 // add the lines 2089 AddTesselationLine(TPS[ 2], TPS[0], 0);2090 AddTesselationLine(TPS[ 2], TPS[1], 1);2091 AddTesselationLine(TPS[ 0], TPS[1], 2);2100 AddTesselationLine(TPS[0], TPS[1], 0); 2101 AddTesselationLine(TPS[0], TPS[2], 1); 2102 AddTesselationLine(TPS[1], TPS[2], 2); 2092 2103 2093 2104 // add the triangles … … 2098 2109 2099 2110 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl; 2100 BaseLine = BLS[0]; // go to next baseline, in order to add in star formation from CandidateLine.BaseLine->endpoints[0]->node 2111 Runner = Sprinter; 2112 Sprinter++; 2101 2113 } 2102 2114 }; … … 2739 2751 } 2740 2752 } else { 2741 list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x); 2753 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]); 2754 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x); 2755 delete(connectedPoints); 2742 2756 if (connectedClosestPoints != NULL) { 2743 2757 trianglePoints[1] = connectedClosestPoints->front(); … … 2917 2931 * 2918 2932 * @param *out output stream for debugging 2933 * @param *SetOfNeighbours all points for which the angle should be calculated 2919 2934 * @param *Point of which get all connected points 2920 2935 * @param *Reference Reference vector for zero angle or NULL for no preference 2921 2936 * @return list of the all points linked to the provided one 2922 2937 */ 2923 list<TesselPoint*> * Tesselation::GetCircleOf ConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const2938 list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const 2924 2939 { 2925 2940 Info FunctionInfo(__func__); 2926 2941 map<double, TesselPoint*> anglesOfPoints; 2927 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);2928 2942 list<TesselPoint*> *connectedCircle = new list<TesselPoint*>; 2929 2943 Vector center; … … 2933 2947 Vector helper; 2934 2948 2935 if ( connectedPoints == NULL) {2949 if (SetOfNeighbours == NULL) { 2936 2950 eLog() << Verbose(2) << "Could not find any connected points!" << endl; 2937 2951 delete(connectedCircle); … … 2940 2954 2941 2955 // calculate central point 2942 for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)2956 for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++) 2943 2957 center.AddVector((*TesselRunner)->node); 2944 2958 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2945 2959 // << "; scale factor " << 1.0/connectedPoints.size(); 2946 center.Scale(1.0/ connectedPoints->size());2960 center.Scale(1.0/SetOfNeighbours->size()); 2947 2961 Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl; 2948 2962 … … 2960 2974 } 2961 2975 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) { 2962 Log() << Verbose(1) << "Using alternatively " << *(* connectedPoints->begin())->node << " as angle 0 referencer." << endl;2963 AngleZero.CopyVector((* connectedPoints->begin())->node);2976 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl; 2977 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 2964 2978 AngleZero.SubtractVector(Point->node); 2965 2979 AngleZero.ProjectOntoPlane(&PlaneNormal); … … 2977 2991 2978 2992 // go through all connected points and calculate angle 2979 for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {2993 for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) { 2980 2994 helper.CopyVector((*listRunner)->node); 2981 2995 helper.SubtractVector(Point->node); … … 2989 3003 connectedCircle->push_back(AngleRunner->second); 2990 3004 } 2991 2992 delete(connectedPoints);2993 3005 2994 3006 return connectedCircle; -
molecuilder/src/tesselation.hpp
r3aa635 r013ad57 251 251 list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const; 252 252 list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const; 253 list<TesselPoint*> * GetCircleOf ConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;253 list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const; 254 254 class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const; 255 255 list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
Note:
See TracChangeset
for help on using the changeset viewer.