//获取特征邻接面的信息,并设置成员变量 public void GetFeatureAdjacentFace() { List <Tag> AdjacentFace = GetAdjacentFace();//特征的邻接面 for (int i = 0; i < AdjacentFace.Count; i++) { MyNewFace FeatureAdjacentFace = new MyNewFace(AdjacentFace[i]); FeatureAdjacentFaceList.Add(FeatureAdjacentFace); } }
//构建Face的矩阵邻接图属性邻接图 public FeatureGraphic() { FaceNodeList = new List <GripchFaceNode>(); DeCompseBaseFaceList = new List <Tag>(); Face[] BodyFace = MyFace.GetFaceOfBody(); NumOfFace = BodyFace.Length; //构建AAG图中的面链表 for (int i = 0; i < BodyFace.Length; i++) { GripchFaceNode faceNode = new GripchFaceNode(); faceNode.AreaOfFace = 0;//的面的表面积 if (MyFace.IsConcaveFace(BodyFace[i].Tag) == 2) { faceNode.FaceConcaConve = FaceConcavity.Concavity;//面的凸凹性 } else if (MyFace.IsConcaveFace(BodyFace[i].Tag) == 1) { faceNode.FaceConcaConve = FaceConcavity.Convexity; } else { faceNode.FaceConcaConve = FaceConcavity.Tangent;//光顺面 } int loopNum = 0, InnerloopNum = 0; GetLoopsNumber(BodyFace[i].Tag, ref loopNum, ref InnerloopNum); faceNode.FaceInnerLoopNumber = InnerloopNum; //面中内环的数目 faceNode.FaceLoopNumber = loopNum; //面中环的数目 faceNode.FaceTag = BodyFace[i].Tag; faceNode.NodeFaceType = MyNewFace.getFaceType(BodyFace[i]); faceNode.IsDeCompseBaseFace = faceNode.IsBaseFace(); if (faceNode.IsDeCompseBaseFace) { DeCompseBaseFaceList.Add(BodyFace[i].Tag); } faceNode.IsConCavityFace = faceNode.IsConCavityFacebyEdge(); faceNode.FaceInnerLoopEdges = faceNode.GetFaceInnerListEdges(); //faceNode.IsConCavityFace = IsConCavityFacebyEdge(faceNode.FaceTag); int type = 0; //面的类型 double[] point = { 0.0, 0.0, 0.0 }; //圆柱面、圆锥面轴线上的一点 double[] dir = { 0.0, 0.0, 0.0 }; //轴线方向 double[] box = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; //面的包容盒 double radius; double rad_data; int norm_dir = 0; Program.theUfmodel.AskFaceData(BodyFace[i].Tag, out type, point, dir, box, out radius, out rad_data, out norm_dir); if (faceNode.NodeFaceType == MyNewFaceType.Cylindrical || faceNode.NodeFaceType == MyNewFaceType.Conical) { //数组还可这样赋值? faceNode.Face_Axis[0] = Math.Round(dir[0], 2); faceNode.Face_Axis[1] = Math.Round(dir[1], 2); faceNode.Face_Axis[2] = Math.Round(dir[2], 2); faceNode.Face_Axis_Point[0] = Math.Round(point[0], 2); faceNode.Face_Axis_Point[1] = Math.Round(point[1], 2); faceNode.Face_Axis_Point[2] = Math.Round(point[2], 2); } FaceNodeList.Add(faceNode); } //构建二维AAG图中的属性邻接图主要包含边的信息 adjmatrix = new GripchEdgeNode[NumOfFace, NumOfFace]; Tag[] shared_edges; for (int i = 0; i < BodyFace.Length; ++i) { for (int j = 0; j < BodyFace.Length; ++j) { if (i == j) { adjmatrix[i, j] = null; continue; } //判断两个面是否相邻 Program.theUfmodel.AskSharedEdges(BodyFace[i].Tag, BodyFace[j].Tag, out shared_edges); if (shared_edges.Length == 0)//不相邻的情况取null { adjmatrix[i, j] = adjmatrix[j, i] = null; } else { GripchEdgeNode EdgeNode = new GripchEdgeNode(); EdgeNode.EdgeConcaConve = MyNewEdge.GetEdgeConca(shared_edges[0]); EdgeNode.EdgeTag = shared_edges[0]; EdgeNode.NodeEdgeType = MyNewEdge.GetEdgeType(shared_edges[0]); EdgeNode.LooType = true;//暂定true; adjmatrix[i, j] = EdgeNode; } } } InnerLoopEdgeNumber = GetInnerLoopEdgesNumber(); InnerLoopEdgeList = new List <Tag>(); Tag InneerEdge; /*GetInnerLoopEdge(InneerEdgeArray,InnerLoopEdgeNumber);*/ for (int i = 0; i < InnerLoopEdgeNumber; ++i) { InneerEdge = GetInnerIndexEdge(i); InnerLoopEdgeList.Add(InneerEdge); } //初始化用来存储,AAG图中分解的特征 SubFeaturesList = new List <MyNewDefineFeature>(); }
//内环边删除后,根据给定的面List来构建属性邻接图 public FeatureGraphic(List <Tag> FaceList) { FaceNodeList = new List <GripchFaceNode>(); DeCompseBaseFaceList = new List <Tag>(); NumOfFace = FaceList.Count; //构建AAG图中的面链表 for (int i = 0; i < NumOfFace; i++) { GripchFaceNode faceNode = new GripchFaceNode(); faceNode.AreaOfFace = 0;//的面的表面积 if (MyFace.IsConcaveFace(FaceList[i]) == 2) { faceNode.FaceConcaConve = FaceConcavity.Concavity;//面的凸凹性 } else if (MyFace.IsConcaveFace(FaceList[i]) == 1) { faceNode.FaceConcaConve = FaceConcavity.Convexity; } else { faceNode.FaceConcaConve = FaceConcavity.Tangent;//光顺面 } int loopNum = 0, InnerloopNum = 0; GetLoopsNumber(FaceList[i], ref loopNum, ref InnerloopNum); faceNode.FaceInnerLoopNumber = 0; //面中内环的数目 faceNode.FaceLoopNumber = loopNum; //面中环的数目 faceNode.FaceTag = FaceList[i]; faceNode.NodeFaceType = MyNewFace.getFaceType(FaceList[i]); faceNode.IsDeCompseBaseFace = faceNode.IsBaseFace(); if (faceNode.IsDeCompseBaseFace) { DeCompseBaseFaceList.Add(FaceList[i]); } //面凸凹性的判断,需要根据凹边是否存在 faceNode.IsConCavityFace = faceNode.IsConCavityFacebyEdge(); //faceNode.FaceInnerLoopEdges = faceNode.GetFaceInnerListEdges();//得到面的内环边 int type = 0; //面的类型 double[] point = { 0.0, 0.0, 0.0 }; //圆柱面、圆锥面轴线上的一点 double[] dir = { 0.0, 0.0, 0.0 }; //轴线方向 double[] box = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; //面的包容盒 double radius; double rad_data; int norm_dir = 0; Program.theUfmodel.AskFaceData(FaceList[i], out type, point, dir, box, out radius, out rad_data, out norm_dir); if (faceNode.NodeFaceType == MyNewFaceType.Cylindrical || faceNode.NodeFaceType == MyNewFaceType.Cylindrical) { //数组还可这样赋值? faceNode.Face_Axis = dir; faceNode.Face_Axis_Point = point; } FaceNodeList.Add(faceNode); } //构建二维AAG图中的属性邻接图主要包含边的信息 adjmatrix = new GripchEdgeNode[NumOfFace, NumOfFace]; Tag[] shared_edges; for (int i = 0; i < FaceList.Count; ++i) { for (int j = 0; j < FaceList.Count; ++j) { if (i == j) { adjmatrix[i, j] = null; continue; } //判断两个面是否相邻 Program.theUfmodel.AskSharedEdges(FaceList[i], FaceList[j], out shared_edges); if (shared_edges.Length == 0)//不相邻的情况取null { adjmatrix[i, j] = adjmatrix[j, i] = null; } else { GripchEdgeNode EdgeNode = new GripchEdgeNode(); EdgeNode.EdgeConcaConve = MyNewEdge.GetEdgeConca(shared_edges[0]); EdgeNode.EdgeTag = shared_edges[0]; EdgeNode.NodeEdgeType = MyNewEdge.GetEdgeType(shared_edges[0]); EdgeNode.LooType = true;//暂定true; adjmatrix[i, j] = EdgeNode; } } } //初始化用来存储,AAG图中分解的特征 SubFeaturesList = new List <MyNewDefineFeature>(); }