public void ToPrint() { util u1 = new util(); u1.InFile(u1.infopath, "---surface---"); p1.ToPrint(); p2.ToPrint(); p3.ToPrint(); u1.InFile(u1.infopath, "---end---"); }
public override string ToString() { util u1 = new util(); string str = "ok"; u1.InFile(u1.infopath, "---LINE---"); p1.ToPrint(); p2.ToPrint(); u1.InFile(u1.infopath, "---end---"); return(":" + '(' + p1.x + ',' + p1.y + ',' + p1.z + ')' + '(' + p2.x + ',' + p2.y + ',' + p2.z + ')'); }
private void Insert1() { util u1 = new util(); LINE l0 = nt_current.Data; pg.ToPrint(info); /*获取线链的头边和尾边的外端点*/ PO PLa, PFa; if (pkey.IsEqualToMe(l0.p1)) { PLa = l0.p2; } else { PLa = l0.p1; } if (pkey.IsEqualToMe(pre_l.Head.Data.p1)) { PFa = pre_l.Head.Data.p2; } else { PFa = pre_l.Head.Data.p1; } if (pg.selected) { info.Insert("po selected"); } else { info.Insert("po not selected"); } LINE lt;//获取相应边 info.Insert("t4"); #region PLa-PFa已存在 //如果PLa-PFa已存在,且尾边位于首边未搜索侧或首边两侧都搜索过 lt = Is_OutSide(PLa, PFa); if (lt != null) { info.Insert("ok"); } if (lt != null && (u1.noSearched(pre_l.Head.Data, PLa) || !pre_l.Head.Data.positive && !pre_l.Head.Data.negtive) && pkey.key != 3) { info.Insert("t1"); pkey.non_merged = false; Set_direction(pre_l.Head.Data, PLa); Set_direction(pre_l.Last.Data, PFa); Set_direction(lt, pkey); nt_current = nt_current.Next; // u1.InFile(u1.tri_num, (numbertri++).ToString() + '\t' + pkey.number + '\t' + PLa.number + '\t' + PFa.number); return; } #endregion //后面的没有PLa-PFa已存在的情况 #region pg位于其已搜索侧 if (!u1.noSearched(pre_l.Head.Data, pg) && u1.noSearched(pre_l.Head.Data, PLa) || pg == PFa) { //pg是当前边首边的外端点 info.Insert("t3"); pkey.non_merged = false; Set_direction(pre_l.Head.Data, PLa); Set_direction(l0, PFa); AddLine(PFa, PLa, pkey); nt_current = nt_current.Next; return; //u1.InFile(u1.tri_num, (numbertri++).ToString() + '\t' + pkey.number + '\t' + PLa.number + '\t' + PFa.number); } #endregion if (pg.selected) { //如果pg已经被选过 #region delete shadowpo //当前被处理的点的影子点位于pg的边链上 LINE shadow_l = Is_OutSide(pg, pkey); if (shadow_l != null) { info.Insert("shadow_pg_side"); PO shadow_po = shadow_l.getanotherpo(pg); PO shadow_po1, shadow_po2, shadow_pokey; shadow_po1 = shadow_po.ll.Head.Data.getanotherpo(shadow_po); shadow_po2 = shadow_po.ll.Last.Data.getanotherpo(shadow_po); float shadow_ang1, shadow_ang2; shadow_pokey = shadow_po1; shadow_ang1 = u1.d2_Cal_Op_Angle(PLa, shadow_po1, pkey); shadow_ang2 = u1.d2_Cal_Op_Angle(PLa, shadow_po2, pkey); if (shadow_ang2 < shadow_ang1) { shadow_pokey = shadow_po2; } lt = Is_OutSide(shadow_pokey, PLa); if (lt == null) { lt = AddLine(shadow_pokey, PLa, shadow_po); } PAINT.GetLL(lt); shadowPO(shadow_po, shadow_pokey, pkey, PLa); nt_current = pkey.ll.Last; return; } #endregion #region last's outside //如果pg是last的边链的外端点 lt = Is_OutSide(PLa, pg); if (lt != null) { info.Insert("last's outside\n"); Set_direction(pre_l.Last.Data, pg); AddLine(pkey, pg, PLa); //以上两句代码的顺序不能反,否则会出错 Set_direction(lt, pkey); nt_current = nt_current.Next; return; } #endregion last'soutside #region shadow_deal #region create shadowpo //如果pg是非特殊位置 info.Insert("arbitrary POint\n"); PO pt = new PO(pg.x, pg.y, pg.z); if (pg.shadow_pl != null) { pg.shadow_pl.Insert(pt); } else { info.Insert("add new shadow po\n"); pg.shadow_pl = new LinkList <PO>(); pg.shadow_pl.Insert(pg); pg.shadow_pl.Insert(pt); } pt.shadow_pl = pg.shadow_pl; pg = pt; //u1.InFile(u1.infopath, "here1"); AddLine(pkey, pg, PLa); // u1.InFile(u1.infopath, "here2"); AddLine(PLa, pg, pkey); //u1.InFile(u1.infopath, "here3"); Set_direction(l0, pg); // u1.InFile(u1.infopath, "here4"); //u1.InFile(u1.tri_num, (numbertri++).ToString() + '\t' + pkey.number + '\t' + PLa.number + '\t' + pg.number); work_pl.Insert(pg); //u1.InFile(u1.infopath,"here5"); pg.selected = true; nt_current = nt_current.Next; #endregion #endregion } else { #region ordinary_po info.Insert("ordinary point" + pg.number); //pg作为普通点处理 pg.number = number++; pg.selected = true; //u1.InFile(u1.node_key, pg.number.ToString() + '\t' + pg.x + '\t' + pg.y + '\t' + pg.key); AddLine(pkey, pg, PLa); AddLine(PLa, pg, pkey); Set_direction(l0, pg); //u1.InFile(u1.tri_num, (numbertri++).ToString() + '\t' + pkey.number + '\t' + PLa.number + '\t' + pg.number); if (pg.key != 3) { work_pl.Insert(pg); } //work_pl.Dispaly(); nt_current = nt_current.Next; #endregion } }