/// <summary> /// 求圆柱体绕射模型表面的细分三角形 /// </summary> /// <param name="originPoint">辐射源</param> /// <param name="diffractionPoint1">绕射点1</param> /// <param name="diffractionPoint">绕射点2</param> /// <param name="diffractionEdge">绕射棱</param> /// <param name="divisionNumber">细分系数</param> /// <param name="angleOfTwoTers">两个绕射面的夹角</param> /// <returns></returns> private static List <List <Triangle> > GetCirclarTruncatedConeSurfaceDivisionTriangles(Point originPoint, Point diffractionPoint1, Point diffractionPoint2, AdjacentEdge diffractionEdge, int divisionNumber, double angleOfTwoTers) { RayInfo launchRay1 = new RayInfo(originPoint, diffractionPoint1); //从上一节点到绕射点1重新构造一条入射线 RayInfo launchRay2 = new RayInfo(originPoint, diffractionPoint2); //从上一节点到绕射点2重新构造一条入射线 double angleOfRay1AndEdge = launchRay1.GetAngleOfTwoStraightLines(diffractionEdge.SwitchToRay()); //获取射线1与劈边的夹角 double angleOfRay2AndEdge = launchRay2.GetAngleOfTwoStraightLines(diffractionEdge.SwitchToRay()); //获取射线2与劈边的夹角 double distanceToDiffractionPoint1 = originPoint.GetDistance(diffractionPoint1); double distanceToDiffractionPoint2 = originPoint.GetDistance(diffractionPoint2); double circleRadius1, circleRadius2; if (distanceToDiffractionPoint1 > distanceToDiffractionPoint2) { circleRadius1 = (distanceToDiffractionPoint1 - distanceToDiffractionPoint2) * Math.Sin(angleOfRay1AndEdge * Math.PI / 180); circleRadius2 = 2 * (distanceToDiffractionPoint1 - distanceToDiffractionPoint2) * Math.Sin(angleOfRay2AndEdge * Math.PI / 180); } else { circleRadius2 = (distanceToDiffractionPoint2 - distanceToDiffractionPoint1) * Math.Sin(angleOfRay2AndEdge * Math.PI / 180); circleRadius1 = 2 * (distanceToDiffractionPoint2 - distanceToDiffractionPoint1) * Math.Sin(angleOfRay1AndEdge * Math.PI / 180); } Point circleCenterPoint1 = GetCircleCenterPoint(launchRay1, diffractionPoint1, angleOfRay1AndEdge, diffractionEdge, circleRadius1);//在劈边上选一个与绕射射线同向且不是绕射点的点,作为圆盘的圆心 Point circleCenterPoint2 = GetCircleCenterPoint(launchRay2, diffractionPoint2, angleOfRay2AndEdge, diffractionEdge, circleRadius2); //求圆盘面上的一对相互垂直的方向向量 SpectVector circleVectorU = GetVectorInThePlaneOfCircle(diffractionEdge, circleCenterPoint1); //先求圆所在平面上的一个向量 SpectVector circleVectorV = GetQuadratureVectorInTheOfCircle(diffractionEdge, circleVectorU); //再求一个与前面所求向量和劈边向量都正交的向量,该向量也在圆所在的平面上 //圆与三角面的交点 Point crossPointOfFace0AndCircle1 = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[0].SwitchToSpaceFace(), circleCenterPoint1, circleRadius1, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[0].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面1一侧的交点 Point crossPointOfFace1AndCircle1 = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[1].SwitchToSpaceFace(), circleCenterPoint1, circleRadius1, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[1].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面2一侧的交点 if (crossPointOfFace0AndCircle1 == null || crossPointOfFace1AndCircle1 == null) { LogFileManager.ObjLog.debug("求圆盘与绕射面的交点时有错"); return(new List <List <Triangle> >()); } SpectVector circlePointVector;//从大的圆盘的圆心指向小的圆盘的圆心 CirclarTruncatedCone circlarTrimcatedCone; if (distanceToDiffractionPoint1 > distanceToDiffractionPoint2) { circlePointVector = new SpectVector(circleCenterPoint2, circleCenterPoint1).GetNormalizationVector(); SetUnitVectorVnCirclePlane(ref circleVectorU, ref circleVectorV, circleCenterPoint1, crossPointOfFace0AndCircle1, crossPointOfFace1AndCircle1, circlePointVector, angleOfTwoTers); circlarTrimcatedCone = new CirclarTruncatedCone(circleCenterPoint2, circleRadius2, circleCenterPoint1, circleRadius1); } else { circlePointVector = new SpectVector(circleCenterPoint1, circleCenterPoint2).GetNormalizationVector(); SetUnitVectorVnCirclePlane(ref circleVectorU, ref circleVectorV, circleCenterPoint1, crossPointOfFace0AndCircle1, crossPointOfFace1AndCircle1, circlePointVector, angleOfTwoTers); circlarTrimcatedCone = new CirclarTruncatedCone(circleCenterPoint1, circleRadius1, circleCenterPoint2, circleRadius2); } return(circlarTrimcatedCone.GetConeSurfaceDivisionTriangles(divisionNumber, 360 - angleOfTwoTers, circleVectorU, circleVectorV)); }
/// <summary> /// 求射线射到棱上后得到的绕射射线List /// </summary> public static List <RayInfo> GetDiffractionRays(Point originPoint, Point diffractionPoint, AdjacentEdge diffractionEdge, int numberOfRay) { if ((originPoint == null) || (diffractionPoint == null) || (diffractionEdge == null)) { LogFileManager.ObjLog.debug("求绕射射线的方法中输入的参数有null"); return(new List <RayInfo>()); } double angleOfTwoTers = GetAngleOfTwoTers(diffractionEdge.AdjacentTriangles[0], diffractionEdge.AdjacentTriangles[1], diffractionEdge); //获得两个三角面的夹角 if (angleOfTwoTers > 178) { // LogFileManager.ObjLog.debug("输入的绕射面的 夹角大于178度"); return(new List <RayInfo>()); } else { RayInfo inRay = new RayInfo(originPoint, new SpectVector(originPoint, diffractionPoint)); //从上一节点到绕射点重新构造一条入射线 double angleOfRayAndEdge = inRay.GetAngleOfTwoStraightLines(diffractionEdge.SwitchToRay()); //获取射线与劈边的夹角 Point circleCenterPoint = GetCircleCenterPoint(angleOfRayAndEdge, inRay, diffractionEdge, diffractionPoint); //在劈边上选一个与绕射射线同向且不是绕射点的点,一般选公共棱的某个顶点,当夹角为90度时,绕射射线为圆盘,圆心为绕射点 double circleRadius = GetCircleRadius(angleOfRayAndEdge, diffractionPoint, circleCenterPoint, numberOfRay); //所作圆的半径 SpectVector circleVectorU = GetVectorInThePlaneOfCircle(diffractionEdge, circleCenterPoint); //先求圆所在平面上的一个向量 SpectVector circleVectorV = GetQuadratureVectorInTheOfCircle(diffractionEdge, circleVectorU); //再求一个与前面所求向量和劈边向量都正交的向量,该向量也在圆所在的平面上 //圆与三角面的交点 Point crossPointOfFace0AndCircle = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[0].SwitchToSpaceFace(), diffractionPoint, circleRadius, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[0].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面1一侧的交点 Point crossPointOfFace1AndCircle = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[1].SwitchToSpaceFace(), diffractionPoint, circleRadius, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[1].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面2一侧的交点 if (crossPointOfFace0AndCircle == null || crossPointOfFace1AndCircle == null) { LogFileManager.ObjLog.debug("求圆盘与绕射面的交点时有错"); return(new List <RayInfo>()); } SpectVector circlePointVector; if (circleCenterPoint.equal(diffractionPoint)) { circlePointVector = diffractionEdge.LineVector.GetNormalizationVector(); } else { circlePointVector = new SpectVector(diffractionPoint, circleCenterPoint).GetNormalizationVector(); } SetUnitVectorVnCirclePlane(ref circleVectorU, ref circleVectorV, circleCenterPoint, crossPointOfFace0AndCircle, crossPointOfFace1AndCircle, circlePointVector, angleOfTwoTers); List <Point> circumPoints = GetcircumPointOfTheCircle(diffractionEdge, circleCenterPoint, circleRadius, circleVectorU, circleVectorV, 360 - angleOfTwoTers, numberOfRay); //以某个角度划分获得所设圆上的点的list //根据绕射点和所设圆上的点,就可以求出绕射射线 List <RayInfo> diffrationRay = GetRayListOfDiffraction(diffractionPoint, circumPoints); //包含绕射射线的list return(diffrationRay); } }
/// <summary> /// 求从两个绕射点点发出的绕射射线 /// </summary> /// <param name="originPoint1">辐射源1</param> /// <param name="originPoint1">辐射源2</param> /// <param name="diffractionPoint1">绕射点1</param> /// <param name="diffractionPoint">绕射点2</param> /// <param name="diffractionEdge">绕射棱</param> /// <param name="numberOfRay">细分系数</param> /// <returns></returns> public static List <List <RayInfo> > GetDiffractionRaysFromTwoDiffractionPoints(Point originPoint1, Point originPoint2, Point diffractionPoint1, Point diffractionPoint2, AdjacentEdge diffractionEdge, int numberOfRay) { if ((originPoint1 == null) || (originPoint2 == null) || (diffractionPoint1 == null) || (diffractionPoint2 == null) || (diffractionEdge == null)) { LogFileManager.ObjLog.debug("求绕射射线的方法中输入的参数有null"); return(new List <List <RayInfo> >()); } double angleOfTwoTers = GetAngleOfTwoTers(diffractionEdge.AdjacentTriangles[0], diffractionEdge.AdjacentTriangles[1], diffractionEdge);//获得两个三角面的夹角 if (angleOfTwoTers > 178) { // LogFileManager.ObjLog.debug("输入的绕射面的 夹角大于178度"); return(new List <List <RayInfo> >()); } else { Point symmetricPointOfOriginPoint1 = originPoint1.GetSymmetricPointOnEdge(diffractionPoint1); //得到发射点关于绕射点的对称点 Point targetCenterPoint1 = diffractionEdge.SwitchToRay().getDropFoot(symmetricPointOfOriginPoint1); //对称点在棱上对应的垂足 //Point circleCenterPoint = GetCircleCenterPoint(angleOfRayAndEdge, inRay, diffractionEdge, diffractionPoint);//在劈边上选一个与绕射射线同向且不是绕射点的点,一般选公共棱的某个顶点,当夹角为90度时,绕射射线为圆盘,圆心为绕射点 double circleRadius1 = originPoint1.GetDistance(targetCenterPoint1); SpectVector circleVectorU = GetVectorInThePlaneOfCircle(diffractionEdge, targetCenterPoint1); //先求圆所在平面上的一个向量 SpectVector circleVectorV = GetQuadratureVectorInTheOfCircle(diffractionEdge, circleVectorU); //再求一个与前面所求向量和劈边向量都正交的向量,该向量也在圆所在的平面上 //圆与三角面的交点 Point crossPointOfFace0AndCircle = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[0].SwitchToSpaceFace(), targetCenterPoint1, circleRadius1, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[0].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面1一侧的交点 Point crossPointOfFace1AndCircle = GetCrossPointOfCircleWithTer(diffractionEdge.AdjacentTriangles[1].SwitchToSpaceFace(), targetCenterPoint1, circleRadius1, circleVectorU, circleVectorV, diffractionEdge.AdjacentTriangles[1].GetPointsOutOfTheLine(diffractionEdge)[0]); //圆与三角面2一侧的交点 if (crossPointOfFace0AndCircle == null || crossPointOfFace1AndCircle == null) { LogFileManager.ObjLog.debug("求圆盘与绕射面的交点时有错"); return(new List <List <RayInfo> >()); } SpectVector circlePointVector; if (targetCenterPoint1.equal(diffractionPoint1)) { circlePointVector = diffractionEdge.LineVector.GetNormalizationVector(); } else { circlePointVector = new SpectVector(targetCenterPoint1, diffractionPoint1).GetNormalizationVector(); } SetUnitVectorVnCirclePlane(ref circleVectorU, ref circleVectorV, targetCenterPoint1, crossPointOfFace0AndCircle, crossPointOfFace1AndCircle, circlePointVector, angleOfTwoTers); // List <RayInfo> diffractionRay1 = new List <RayInfo>(), diffractionRay2 = new List <RayInfo>(); if (originPoint1.equal(originPoint2)) { List <Point> targetPoints = GetcircumPointOfTheCircle(diffractionEdge, targetCenterPoint1, circleRadius1, circleVectorU, circleVectorV, 360 - angleOfTwoTers, numberOfRay);//以某个角度划分获得所设圆上的点的list //根据绕射点和所设圆上的点,就可以求出绕射射线 for (int i = 0; i < targetPoints.Count; i++) { diffractionRay1.Add(new RayInfo(diffractionPoint1, new SpectVector(diffractionPoint1, targetPoints[i]))); diffractionRay2.Add(new RayInfo(diffractionPoint2, new SpectVector(diffractionPoint2, targetPoints[i]))); } } else { Point symmetricPointOfOriginPoint2 = originPoint2.GetSymmetricPointOnEdge(diffractionPoint2); //得到发射点2关于绕射点的对称点 Point targetCenterPoint2 = diffractionEdge.SwitchToRay().getDropFoot(symmetricPointOfOriginPoint2); //发射点2在棱上对应的垂足 double circleRadius2 = originPoint1.GetDistance(targetCenterPoint2); List <Point> targetPoints1 = GetcircumPointOfTheCircle(diffractionEdge, targetCenterPoint1, circleRadius1, circleVectorU, circleVectorV, 360 - angleOfTwoTers, numberOfRay); //以某个角度划分获得所设圆上的点的list List <Point> targetPoints2 = GetcircumPointOfTheCircle(diffractionEdge, targetCenterPoint2, circleRadius2, circleVectorU, circleVectorV, 360 - angleOfTwoTers, numberOfRay); //以某个角度划分获得所设圆上的点的list for (int i = 0; i < targetPoints1.Count; i++) { diffractionRay1.Add(new RayInfo(diffractionPoint1, new SpectVector(diffractionPoint1, targetPoints1[i]))); diffractionRay2.Add(new RayInfo(diffractionPoint2, new SpectVector(diffractionPoint2, targetPoints2[i]))); } } return(new List <List <RayInfo> > { diffractionRay1, diffractionRay2 }); } }