/// <summary> ///得到ReflectionPoint节点,并加入child节点的子节点List中 /// </summary> private void SetReflectionChildNode(Node fatherNode, Node reNode, Terrain ter, City cityBuilding, ReceiveBall rxBall, double rayBeamAngle, List <FrequencyBand> txFrequencyBand) { reNode.LayNum = fatherNode.LayNum + 1; reNode.DiffractionNum = fatherNode.DiffractionNum; reNode.IsReceiver = false; reNode.UAN = rxBall.UAN; reNode.RayTracingDistance = fatherNode.RayTracingDistance; reNode.RayTracingDistance += reNode.DistanceToFrontNode; reNode.RayIn = new RayInfo(fatherNode.Position, reNode.Position); //当新节点的层数加绕射次数不小于4或者绕射次数大于2,说明该路径已经过三次反射(或两次反射一次绕射)或者两次绕射,舍弃并追踪下一条射线 //将该节点设为end if ((reNode.DiffractionNum >= 2) || ((reNode.LayNum + reNode.DiffractionNum) >= 4)) { reNode.IsEnd = true; // reNode.NodeStyle = NodeStyle.FinalNode; fatherNode.ChildNodes.Add(reNode); } //否则,递归调用该函数继续追踪射线 else { reNode.IsEnd = false; fatherNode.ChildNodes.Add(reNode); RayInfo ReflectionRay = reNode.RayIn.GetReflectionRay(reNode.ReflectionFace, reNode.Position); PunctiformPath newPath = new PunctiformPath(ReflectionRay, ter); newPath.SetPunctiformRayPathNodes(reNode, ter, rxBall, cityBuilding, rayBeamAngle, txFrequencyBand); } }
/// <summary> ///求从辐射源发出的一条射线的所有路径 /// </summary> private List <Path> GetSingleRayPaths(Node tx, Terrain ter, ReceiveBall rxBall, City cityBuilding, RayInfo inRay, double rayBeamAngle, List <FrequencyBand> txFrequencyBand) { // Point test = new AdjacentEdge(new Point(-1111.08, -3527.01, 5000), new Point(-1111.08, 5563.65, 5000), new SpectVector(new Point(-1111.08, -3527.01, 5000), new Point(-1111.08, 5563.65, 5000))).GetDiffractionPoint(tx.Position,rxBall.Receiver); // inRay.RayVector = new SpectVector(tx.Position,test); PunctiformPath pathTracing = new PunctiformPath(inRay, ter); pathTracing.SetPunctiformRayPathNodes(tx, ter, rxBall, cityBuilding, rayBeamAngle, txFrequencyBand); List <Path> temp = new List <Path>(); if (tx.ChildNodes.Count != 0) { temp = this.GetLegalPaths(tx); tx.ChildNodes.Clear(); } return(temp); }
/// <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); } } } } }