public override int Compare(PointFr p1, PointFr p2) { var o = O ?? new PointFr(0, 0); var op1 = new LineSegmentFr(o, p1); var op2 = new LineSegmentFr(o, p2); var pos = GeometryCalculations.PointFrOrientationTest(p1, op2); // po lewej stronie > 0 if (pos > 0 || (pos == 0 && op1.Length() < op2.Length())) { return(Inverse ? -1 : 1); } if (pos < 0 || (pos == 0 && op1.Length() > op2.Length())) { return(Inverse ? 1 : -1); } return(0); }
private void calculateGeometry() { double B = Convert.ToDouble(ConstructionWidth.Text); double Hc = Convert.ToDouble(CapHeight.Text); double Hd = Convert.ToDouble(SpaceUnder.Text); GeometryParameters.ConstructionWidth = B; GeometryParameters.CapHeight = Hc; GeometryParameters.SpaceUnder = Hd; double a = Convert.ToDouble(GetA.Text); double x = Convert.ToDouble(GetX.Text); double b = Convert.ToDouble(GetB.Text); double y = Convert.ToDouble(GetY.Text); var profiles = new Database().Profiles; var steels = new Database().Steels; if (ProfileChoice.SelectedValue.ToString() == "R1400") { var p = profiles.First(profile => profile.ProfileType == ProfileType.R1400); if (SteelChoice.SelectedValue.ToString() == "S235") { var s = steels.First(steel => steel.SteelType == SteelType.S235); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } else if (SteelChoice.SelectedValue.ToString() == "S355") { var s = steels.First(steel => steel.SteelType == SteelType.S355); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } } else if (ProfileChoice.SelectedValue.ToString() == "R1000") { var p = profiles.First(profile => profile.ProfileType == ProfileType.R1000); if (SteelChoice.SelectedValue.ToString() == "S235") { var s = steels.First(steel => steel.SteelType == SteelType.S235); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } else if (SteelChoice.SelectedValue.ToString() == "S355") { var s = steels.First(steel => steel.SteelType == SteelType.S355); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } } else if (ProfileChoice.SelectedValue.ToString() == "R500") { var p = profiles.First(profile => profile.ProfileType == ProfileType.R500); if (SteelChoice.SelectedValue.ToString() == "S235") { var s = steels.First(steel => steel.SteelType == SteelType.S235); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } else if (SteelChoice.SelectedValue.ToString() == "S355") { var s = steels.First(steel => steel.SteelType == SteelType.S355); GeometryCalculations.GeometryParametersCalc(p, s, x, y, a, b); } } }