| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -19,11 +19,9 @@ inline Vec2 get2DRepOf3DPt(const Vec3 &pt3D, const Vec3 &u, const Vec3 &v, const | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Vec3 OP = pt3D - localO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return {OP.dot(u), OP.dot(v)}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					inline Vec2 get2DRepOf3DDir(const Vec3 &dir, const Vec3 &u, const Vec3 &v) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return Vec2{dir.dot(u), dir.dot(v)}.normalize(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class IExtrudedSolid : public ISolid { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<Polyline> _profiles; // TODO: may be replaced by const ref to profile
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -51,7 +49,6 @@ private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    std::vector<std::vector<CircularArc<Vec2>>> _localArcs2d; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Pt2Array _localCircleCenter2D;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Pt2Array _localInCircleDir;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    ExtrudedSolidPolyline(std::vector<Polyline> profiles, Polyline axis, real rScale) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        : IExtrudedSolid(std::move(profiles), rScale), _axis(std::move(axis)) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -90,11 +87,17 @@ public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ClosestDescOnSeg closestDescToAxis = _axis.getClosestParam(p); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // TNB coordinate system
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        auto t = closestDescToAxis.t; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 Q = _axis.eval(t); // closest point on axis
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 QP = p - Q; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 T = _axis.der1(t).normalize(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (_axis.isEndParm(t) && fabs(QP.dot(T)) > EPS) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // project p to the plane passing through Q and perpendicular to T
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Vec3 projP = p + T * (-QP.dot(T)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 N = _axis.der2(t).normalize(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 B = T.cross(N); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 Q = _axis.eval(t); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Vec3 QP = p - Q; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        auto p2D = get2DRepOf3DPt(QP, N, B, Q); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // PMC
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PtBoundaryRelation ptProfileRelation = Inside; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -109,6 +112,7 @@ public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // distance
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ClosestDescOnSeg closestDescToProfile{}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (int i = 0; i < _localArcs2d.size(); ++i) { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -122,7 +126,7 @@ public: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					private: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /**
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** 低于2Dprofile的内外部判定
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * in + in = out | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * in + out = in | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * out + in = in | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |