소스 검색

new offset patch

bstouls 9 년 전
부모
커밋
81d5562b0f
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      hxd/clipper/Clipper.hx

+ 7 - 3
hxd/clipper/Clipper.hx

@@ -3954,9 +3954,13 @@ class ClipperOffset
 
 		if (m_sinA * m_delta < 0)
 		{
-			m_destPoly.push(new IPoint(Math.round(m_srcPoly[j].x + m_normals[k].x * m_delta), Math.round(m_srcPoly[j].y + m_normals[k].y * m_delta)));
-			m_destPoly.push(m_srcPoly[j]);
-			m_destPoly.push(new IPoint(Math.round(m_srcPoly[j].x + m_normals[j].x * m_delta), Math.round(m_srcPoly[j].y + m_normals[j].y * m_delta)));
+			var p1 = new IPoint(Math.round(m_srcPoly[j].x + m_normals[k].x * m_delta), Math.round(m_srcPoly[j].y + m_normals[k].y * m_delta));
+			var p2 = new IPoint(Math.round(m_srcPoly[j].x + m_normals[j].x * m_delta), Math.round(m_srcPoly[j].y + m_normals[j].y * m_delta));
+			m_destPoly.push(p1);
+			if(hxd.Math.distanceSq(p1.x - p2.x, p1.y -p2.y ) > 1){
+				m_destPoly.push(m_srcPoly[j]);
+				m_destPoly.push(p2);
+			}
 		}
 		else
 		switch (jointype)