mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 03:58:49 +00:00
Line支持Clip
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XUGL;
|
||||
|
||||
@@ -174,5 +175,31 @@ namespace XCharts.Runtime
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给定的线段和Grid边界的交点
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="ep"></param>
|
||||
/// <returns></returns>
|
||||
public bool BoundaryPoint(Vector3 sp, Vector3 ep, ref List<Vector3> point)
|
||||
{
|
||||
if (Contains(sp) && Contains(ep))
|
||||
return false;
|
||||
var lb = new Vector3(context.x, context.y);
|
||||
var lt = new Vector3(context.x, context.y + context.height);
|
||||
var rt = new Vector3(context.x + context.width, context.y + context.height);
|
||||
var rb = new Vector3(context.x + context.width, context.y);
|
||||
var flag = false;
|
||||
if (UGLHelper.GetIntersection(sp, ep, lb, lt, ref point))
|
||||
flag = true;
|
||||
if (UGLHelper.GetIntersection(sp, ep, lt, rt, ref point))
|
||||
flag = true;
|
||||
if (UGLHelper.GetIntersection(sp, ep, lb, rb, ref point))
|
||||
flag = true;
|
||||
if (UGLHelper.GetIntersection(sp, ep, rb, rt, ref point))
|
||||
flag = true;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user