public Form2(int a, int b) { f = a; q = b; string s = "Введите данные фигуры номер 1"; InitializeComponent(); outInfo.Text = s; if (a == 1) { textBox4.Dispose(); DX.Dispose(); DY.Dispose(); } else if (a == 2) { textBox2.Dispose(); BX.Dispose(); BY.Dispose(); textBox4.Dispose(); DX.Dispose(); DY.Dispose(); textBox1.Text = "цент"; textBox3.Text = "R"; CY.Dispose(); } }
private void SaveV_Click(object sender, EventArgs e) { try { AX.Enabled = false; AY.Enabled = false; AZ.Enabled = false; BX.Enabled = false; BY.Enabled = false; BZ.Enabled = false; Point p1 = new Point(Int32.Parse(AX.Text), Int32.Parse(AY.Text), Int32.Parse(AZ.Text)); Point p2 = new Point(Int32.Parse(BX.Text), Int32.Parse(BY.Text), Int32.Parse(BZ.Text)); Vectors vectros = new Vectors(p1, p2); Calculate.AppendText(vectros.Calculate()); Scalar.AppendText(p1.ScalarV(p2) + ";"); Collinearity.AppendText(vectros.IsCollinearity()); } catch (Exception exc) { MessageBox.Show(exc.Message); AX.Clear(); AY.Clear(); AZ.Clear(); BX.Clear(); BY.Clear(); BZ.Clear(); } }
public override string ToString(Context cx) { if (!ObjLuaFunction.DEBUG) { return(""); } return("// " + R(A) + " = closure(KPROTO[" + BX.ToString() + "])"); }
private void Reset_Click(object sender, EventArgs e) { AX.Clear(); AY.Clear(); AZ.Clear(); BX.Clear(); BY.Clear(); BZ.Clear(); Calculate.Clear(); Scalar.Clear(); Collinearity.Clear(); AX.Enabled = true; AY.Enabled = true; AZ.Enabled = true; BX.Enabled = true; BY.Enabled = true; BZ.Enabled = true; }
public FormattedDiskPagePAPX(VirtualStream wordStream, Int32 offset, VirtualStream dataStream) { this.Type = FKPType.Paragraph; this.WordStream = wordStream; //read the 512 bytes (FKP) byte[] bytes = new byte[512]; wordStream.Read(bytes, 0, 512, offset); //get the count this.crun = bytes[511]; //create and fill the array with the adresses this.rgfc = new Int32[this.crun + 1]; int j = 0; for (int i = 0; i < rgfc.Length; i++) { rgfc[i] = System.BitConverter.ToInt32(bytes, j); j += 4; } //create arrays this.rgbx = new BX[this.crun]; this.grppapx = new ParagraphPropertyExceptions[this.crun]; j = 4 * (this.crun + 1); for (int i = 0; i < rgbx.Length; i++) { //read the 12 for PHE byte[] phe = new byte[12]; Array.Copy(bytes, j + 1, phe, 0, phe.Length); //fill the rgbx array BX bx = new BX(); bx.wordOffset = bytes[j]; bx.phe = new ParagraphHeight(phe, false); rgbx[i] = bx; j += 13; if (bx.wordOffset != 0) { //read first byte of PAPX //PAPX is stored in a FKP; so the first byte is a count of words byte padbyte = 0; byte cw = bytes[bx.wordOffset * 2]; //if that byte is zero, it's a pad byte, and the word count is the following byte if (cw == 0) { padbyte = 1; cw = bytes[bx.wordOffset * 2 + 1]; } if (cw != 0) { //read the bytes for papx byte[] papx = new byte[cw * 2]; Array.Copy(bytes, (bx.wordOffset * 2) + padbyte + 1, papx, 0, papx.Length); //parse PAPX and fill grppapx this.grppapx[i] = new ParagraphPropertyExceptions(papx, dataStream); } } else { //create a PAPX which doesn't modify anything this.grppapx[i] = new ParagraphPropertyExceptions(); } } }
protected override string ToAsmString() { return(R(A) + " = closure(KPROTO[" + BX.ToString() + "])"); }
public static void ConflictResolution(FuzzyModel fm, float preserveThr, float ratioThr) { List <FuzzyEdge> toRemove = new List <FuzzyEdge>(); foreach (FuzzyEdge AB in fm.GetEdges()) { FuzzyEdge BA = fm.GetEdge(AB.GetToNode(), AB.GetFromNode()); float relAB = 0; float relBA = 0; if (BA != null) { if (AB.Equals(BA)) { toRemove.Add(AB); } if (toRemove.Contains(AB) || toRemove.Contains(BA)) { continue; } FuzzyNode A = AB.GetFromNode(); FuzzyNode B = AB.GetToNode(); // compute relative significance of edge A->B float sigAB = AB.GetFrequencySignificance(); float sigAX = 0; foreach (FuzzyEdge AX in A.GetOutEdges()) { sigAX += AX.GetFrequencySignificance(); } float sigXB = 0; foreach (FuzzyEdge XB in B.GetInEdges()) { sigXB += XB.GetFrequencySignificance(); } relAB = (0.5F * (sigAB / sigAX)) + (0.5F * (sigAB / sigXB)); Console.WriteLine("{0}, Relative significance: {1}", AB.ToString(), relAB); // compute relative significance of edge B->A float sigBA = BA.GetFrequencySignificance(); float sigBX = 0; foreach (FuzzyEdge BX in B.GetOutEdges()) { sigBX += BX.GetFrequencySignificance(); } float sigXA = 0; foreach (FuzzyEdge XA in A.GetInEdges()) { sigXA += XA.GetFrequencySignificance(); } relBA = (0.5F * (sigBA / sigBX)) + (0.5F * (sigBA / sigXA)); Console.WriteLine("{0}, Relative significance: {1}", BA.ToString(), relBA); // Decide preservation if (relAB < preserveThr || relBA < preserveThr) { float ofsAB = Math.Abs(relAB - relBA); if (ofsAB < ratioThr) { toRemove.Add(AB); toRemove.Add(BA); } else { if (relAB > relBA) { toRemove.Add(BA); } else { toRemove.Add(AB); } } } } } foreach (FuzzyEdge fe in toRemove) { fm.RemoveEdge(fe); } }