mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 10:50:08 +00:00
优化Line在数据点过密时有更好的绘制效果
This commit is contained in:
@@ -77,6 +77,7 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2024.11.18) 优化`Line`在数据点过密时有更好的绘制效果
|
||||||
* (2024.11.16) 修复`Animation`无法通过代码开启的问题 (#334)
|
* (2024.11.16) 修复`Animation`无法通过代码开启的问题 (#334)
|
||||||
* (2024.11.13) 修复`DataZoom`的start和end在代码动态修改时图表不刷新的问题
|
* (2024.11.13) 修复`DataZoom`的start和end在代码动态修改时图表不刷新的问题
|
||||||
* (2024.11.05) 修复`Title`设置隐藏后运行还显示的问题
|
* (2024.11.05) 修复`Title`设置隐藏后运行还显示的问题
|
||||||
|
|||||||
@@ -344,33 +344,85 @@ namespace XUGL
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ldist = (Vector3.Distance(cp, lp) + 1) * dir1;
|
var ldist = (Vector3.Distance(cp, lp) + width) * dir1;
|
||||||
var rdist = (Vector3.Distance(cp, np) + 1) * dir2;
|
var rdist = (Vector3.Distance(cp, np) + width) * dir2;
|
||||||
|
|
||||||
bitp = true;
|
bitp = UGLHelper.GetIntersection(ltp, ltp + ldist, ntp, ntp + rdist, ref itp);
|
||||||
if (!UGLHelper.GetIntersection(ltp, ltp + ldist, ntp, ntp + rdist, ref itp))
|
bibp = UGLHelper.GetIntersection(lbp, lbp + ldist, nbp, nbp + rdist, ref ibp);
|
||||||
|
if (bitp == bibp)
|
||||||
{
|
{
|
||||||
itp = cp - dir1v;
|
if (!bitp)
|
||||||
clp = cp - dir1v;
|
{
|
||||||
crp = cp - dir2v;
|
if (cp == np)
|
||||||
bitp = false;
|
{
|
||||||
|
ltp = cp - dir1v;
|
||||||
|
clp = cp + dir1v;
|
||||||
|
crp = cp + dir1v;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 ibp2 = Vector3.zero;
|
||||||
|
if (UGLHelper.GetIntersection(lbp, lbp + ldist, ntp, nbp, ref ibp2))
|
||||||
|
{
|
||||||
|
bibp = true;
|
||||||
|
ibp = ibp2;
|
||||||
|
clp = cp - dir1v;
|
||||||
|
crp = cp - dir2v;
|
||||||
|
}
|
||||||
|
else if (UGLHelper.GetIntersection(ltp, ltp + ldist, nbp, ntp, ref ibp2))
|
||||||
|
{
|
||||||
|
bitp = true;
|
||||||
|
itp = ibp2;
|
||||||
|
clp = cp + dir1v;
|
||||||
|
crp = cp + dir2v;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsUp(lp, cp, np))
|
||||||
|
{
|
||||||
|
bibp = true;
|
||||||
|
|
||||||
|
clp = cp - dir1v;
|
||||||
|
crp = cp - dir2v;
|
||||||
|
ibp = cp - Vector3.Cross((crp - clp).normalized, Vector3.back).normalized * width * 2f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bitp = true;
|
||||||
|
clp = cp + dir1v;
|
||||||
|
crp = cp + dir2v;
|
||||||
|
itp = cp + Vector3.Cross((crp - clp).normalized, Vector3.back).normalized * width * 2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bibp = true;
|
else
|
||||||
if (!UGLHelper.GetIntersection(lbp, lbp + ldist, nbp, nbp + rdist, ref ibp))
|
|
||||||
{
|
{
|
||||||
ibp = cp + dir1v;
|
if (!bitp)
|
||||||
clp = cp + dir1v;
|
{
|
||||||
crp = cp + dir2v;
|
itp = cp;
|
||||||
bibp = false;
|
clp = cp - dir1v;
|
||||||
}
|
crp = cp - dir2v;
|
||||||
if (bitp == false && bibp == false && cp == np)
|
}
|
||||||
{
|
else
|
||||||
ltp = cp - dir1v;
|
{
|
||||||
clp = cp + dir1v;
|
ibp = cp;
|
||||||
crp = cp + dir1v;
|
clp = cp + dir1v;
|
||||||
|
crp = cp + dir2v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3)
|
||||||
|
{
|
||||||
|
var v1 = p1 - p2;
|
||||||
|
var v2 = p3 - p2;
|
||||||
|
var cross = v1.x * v2.y - v1.y * v2.x;
|
||||||
|
return cross > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)
|
public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)
|
||||||
{
|
{
|
||||||
var dire1 = check - p1;
|
var dire1 = check - p1;
|
||||||
|
|||||||
Reference in New Issue
Block a user