/// <summary> ///得到DiffractionPoint节点,并加入child节点的子节点List中 /// </summary> /// <param name="fatherNode">父节点</param> /// <param name="cylinderCrossNode">绕射相交点</param> /// <param name="ter">地形</param> /// <param name="reArea">态势区域</param> /// <param name="cityBuilding">建筑物</param> /// <param name="TxFrequencyBand">发射机频段信息</param> /// <returns></returns> private void SetDiffractionNode(Node fatherNode, Node cylinderCrossNode, Terrain ter, City cityBuilding, ReceiveArea reArea, List <FrequencyBand> txFrequencyBand) { Node diffractionNode = new Node(); diffractionNode.Position = cylinderCrossNode.DiffractionEdge.GetPedalPoint(cylinderCrossNode.Position); //若求出的绕射点位置在绕射棱外部或者与绕射棱两个端点重合 if (!cylinderCrossNode.DiffractionEdge.JudgeIfPointInLineRange(diffractionNode.Position) || diffractionNode.Position.equal(cylinderCrossNode.DiffractionEdge.StartPoint) || diffractionNode.Position.equal(cylinderCrossNode.DiffractionEdge.EndPoint)) { return; } else { diffractionNode.DiffractionEdge = cylinderCrossNode.DiffractionEdge; diffractionNode.DisranceToEdge = cylinderCrossNode.DisranceToEdge; diffractionNode.NodeStyle = NodeStyle.DiffractionNode; diffractionNode.LayNum = fatherNode.LayNum; diffractionNode.DiffractionNum = fatherNode.DiffractionNum + 1; diffractionNode.IsReceiver = false; diffractionNode.UAN = reArea.UAN; diffractionNode.DistanceToFrontNode = diffractionNode.Position.GetDistance(fatherNode.Position); diffractionNode.RayTracingDistance = fatherNode.RayTracingDistance; diffractionNode.RayTracingDistance += diffractionNode.DistanceToFrontNode; diffractionNode.RayIn = new RayInfo(fatherNode.Position, diffractionNode.Position); if (fatherNode.tempNode == null) { fatherNode.ChildNodes.Add(diffractionNode); } else { // diffractionNode.DistanceToFrontNode = diffractionNode.Position.GetDistance(fatherNode.tempNode.Position); fatherNode.tempNode.ChildNodes.Add(diffractionNode); } // diffractionNode.JudgeIfNodeIsInArea(ter,reArea); //当新节点的层数加绕射次数不小于4或者绕射次数大于2,说明该路径已经过三次反射(或两次反射一次绕射)或者两次绕射,舍弃并追踪下一条射线,并将该节点设为end //但是当该节点在态势区域内时,则继续追踪 if (((diffractionNode.DiffractionNum >= 2) || ((diffractionNode.LayNum + diffractionNode.DiffractionNum) >= 4)) && !diffractionNode.IsReceiver) { diffractionNode.IsEnd = true; } //否则继续追踪射线 else { diffractionNode.IsEnd = false; List <RayInfo> DiffractionRays = Rays.GetDiffractionRays(fatherNode.Position, diffractionNode.Position, diffractionNode.DiffractionEdge, 12); for (int i = 0; i < DiffractionRays.Count; i++) { //AreaPath areaPath = new AreaPath(DiffractionRays[i], ter, reArea); //areaPath.SetAreaRayPathNodes(diffractionNode, ter, reArea, cityBuilding, txFrequencyBand); } } } }
/// <summary> ///得到DiffractionPoint节点,并加入child节点的子节点List中 /// </summary> private void GetDiffractionNode(Node fatherNode, Node cylinderCrossNode, Terrain ter, City cityBuilding, ReceiveBall rxBall, double rayBeamAngle, List <FrequencyBand> txFrequencyBand) { Point diffractionPoint = new RayInfo(cylinderCrossNode.DiffractionEdge.StartPoint, cylinderCrossNode.DiffractionEdge.LineVector).GetFootPointWithSkewLine(this.inRay); if (!cylinderCrossNode.DiffractionEdge.JudgeIfPointInLineRange(diffractionPoint))//若绕射点不在棱内 { return; } else { List <Point> diffPostions = this.GetDiffractionNodePoistions(diffractionPoint, cylinderCrossNode.DiffractionEdge); for (int i = 0; i < diffPostions.Count; i++) { Node diffractionNode = new Node(); diffractionNode.Position = diffPostions[i]; diffractionNode.DiffractionEdge = cylinderCrossNode.DiffractionEdge; diffractionNode.DisranceToEdge = diffractionPoint.GetDistanceToLine(cylinderCrossNode.DiffractionEdge.StartPoint, cylinderCrossNode.DiffractionEdge.LineVector); diffractionNode.NodeStyle = NodeStyle.DiffractionNode; diffractionNode.LayNum = fatherNode.LayNum + 1; diffractionNode.DiffractionNum = fatherNode.DiffractionNum + 1; diffractionNode.IsReceiver = false; diffractionNode.UAN = rxBall.UAN; diffractionNode.DistanceToFrontNode = diffractionNode.Position.GetDistance(fatherNode.Position); diffractionNode.RayTracingDistance = fatherNode.RayTracingDistance; diffractionNode.RayTracingDistance += diffractionNode.DistanceToFrontNode; diffractionNode.RayIn = new RayInfo(fatherNode.Position, diffractionNode.Position); //当新节点的层数加绕射次数不小于4或者绕射次数大于2,说明该路径已经过三次反射(或两次反射一次绕射)或者两次绕射,舍弃并追踪下一条射线 //将该节点设为end if ((diffractionNode.DiffractionNum >= 2) || ((diffractionNode.LayNum + diffractionNode.DiffractionNum) >= 4)) { diffractionNode.IsEnd = true; } //否则,递归调用该函数继续追踪射线 else { diffractionNode.IsEnd = false; fatherNode.ChildNodes.Add(diffractionNode); List <RayInfo> diffractionRays = Rays.GetDiffractionRays(fatherNode.Position, diffractionNode.Position, diffractionNode.DiffractionEdge, 36);//采用新的方法获得绕射射线 for (int j = 0; j < diffractionRays.Count; j++) { PunctiformPath newPath = new PunctiformPath(diffractionRays[j], ter); newPath.SetPunctiformRayPathNodes(diffractionNode, ter, rxBall, cityBuilding, rayBeamAngle, txFrequencyBand); } } } } }
/// <summary> ///根据绕射棱两侧的绕射射线生成绕射追踪模型 /// </summary> /// <param name="fatherPoint">父节点</param> /// <param name="leftRays">左侧的绕射射线</param> /// <param name="rightRays">右侧的绕射射线</param> /// <returns>绕射追踪模型</returns> private List <IRayTracing> GetDiffractionRayFaces(Point diffractionPoint, AdjacentEdge diffractionEdge) { //绕射范围两个端点的位置 Point rightPoint = new RayInfo(diffractionPoint, diffractionEdge.EndPoint).GetPointOnRayVector(diffractionEdge.DiffCylinderRadius); Point leftPoint = new RayInfo(diffractionPoint, diffractionEdge.StartPoint).GetPointOnRayVector(diffractionEdge.DiffCylinderRadius); //将点转成节点 Node leftNode = this.GetDiffractionChildNode(this.fatherNode, leftPoint, diffractionEdge); Node rightNode = this.GetDiffractionChildNode(this.fatherNode, rightPoint, diffractionEdge); //求出左侧节点的绕射射线 List <RayInfo> leftRays = Rays.GetDiffractionRays(this.fatherNode.Position, leftPoint, diffractionEdge, 24); List <IRayTracing> rayFaces = new List <IRayTracing>(); //根据左侧绕射射线生成射线模型 for (int i = 0; i < leftRays.Count; i++) { Point fatherFacePoint = new SpaceFace(diffractionEdge.StartPoint, leftRays[i].RayVector.CrossMultiplied(diffractionEdge.LineVector)).GetSubPointInFace(this.fatherNode.Position); Point fatherMirrorPoint = new RayInfo(rightPoint, fatherFacePoint).GetPointOnRayVector(diffractionEdge.DiffCylinderRadius); RayInfo rightRay = new RayInfo(rightPoint, new SpectVector(fatherMirrorPoint, rightPoint)); rayFaces.Add(new FaceRay(leftNode, rightNode, leftRays[i], rightRay)); } return(rayFaces); }