static void Main(string[] args) { /* TempConverter tempconvert = new TempConverter(); double fahrenheit = 35; double celcius = tempconvert.fahrenheitToCelscius(fahrenheit); Console.WriteLine("The temperature in celcius is " + celcius); */ /* GrassCut cut1 = new GrassCut(10, 10, 4, 4, 2); double time = cut1.computeCuttingTime(); Console.WriteLine("The time taken to cut the grass is " + time + " seconds"); */ double sum, diff, product; Floats floatObj = new Floats(); Console.Write("Enter two floating point values.\nValue 1: "); floatObj.x = Convert.ToDouble(Console.ReadLine()); Console.Write("Value 2: "); floatObj.y = Convert.ToDouble(Console.ReadLine()); sum = floatObj.calculateSum(); diff = floatObj.calculateDifference(); product = floatObj.calculateProduct(); Console.WriteLine("The sum is " + sum + "\nThe difference is " + diff + "\nThe prodcut is " + product); }
public virtual bool getHandlePoint(Floats xy, int shapeId, int index) { bool ret = touchvgPINVOKE.MgCoreView_getHandlePoint(swigCPtr, Floats.getCPtr(xy), shapeId, index); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static int getDimensions(int mgView, Floats vars, Chars types) { int ret = democmdsPINVOKE.DemoCmdsGate_getDimensions(mgView, Floats.getCPtr(vars), Chars.getCPtr(types)); if (democmdsPINVOKE.SWIGPendingException.Pending) { throw democmdsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual bool showContextActions(Ints actions, Floats buttonXY, float x, float y, float w, float h) { bool ret = (SwigDerivedClassHasMethod("showContextActions", swigMethodTypes5) ? touchvgPINVOKE.GiView_showContextActionsSwigExplicitGiView(swigCPtr, Ints.getCPtr(actions), Floats.getCPtr(buttonXY), x, y, w, h) : touchvgPINVOKE.GiView_showContextActions(swigCPtr, Ints.getCPtr(actions), Floats.getCPtr(buttonXY), x, y, w, h)); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual bool getBoundingBox(int doc, int gs, Floats box, int shapeId) { bool ret = touchvgPINVOKE.MgCoreView_getBoundingBox__SWIG_2(swigCPtr, doc, gs, Floats.getCPtr(box), shapeId); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual bool getBoundingBox(Floats box) { bool ret = touchvgPINVOKE.MgCoreView_getBoundingBox__SWIG_0(swigCPtr, Floats.getCPtr(box)); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual void Clear() { Strings.Clear(); Ints.Clear(); Floats.Clear(); Bools.Clear(); Colors.Clear(); Vec2s.Clear(); Vec3s.Clear(); }
public virtual bool displayToModel(Floats d) { bool ret = touchvgPINVOKE.MgCoreView_displayToModel(swigCPtr, Floats.getCPtr(d)); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public override bool showContextActions(Ints actions, Floats buttonXY, float x, float y, float w, float h) { ClearActions(); if (actions != null && !createActionImages(actions, buttonXY)) { createActionButtons(actions, buttonXY); } return(isContextActionsVisible()); }
public virtual bool getImageSize(Floats info, int sid) { bool ret = touchvgPINVOKE.MgCoreView_getImageSize(swigCPtr, Floats.getCPtr(info), sid); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual bool getDisplayExtent(int doc, int gs, Floats box) { bool ret = touchvgPINVOKE.MgCoreView_getDisplayExtent__SWIG_1(swigCPtr, doc, gs, Floats.getCPtr(box)); if (touchvgPINVOKE.SWIGPendingException.Pending) { throw touchvgPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Заливка контура пути /// </summary> /// <returns></returns> private Action Fill() { var fillColor = Colors.ContainsKey("FillColor") ? Colors["FillColor"] : Color.White; var fillOpacity = Floats.ContainsKey("FillOpacity") ? (int)Floats["FillOpacity"] : 255; return(() => { using (var brush = new SolidBrush(Color.FromArgb(fillOpacity, fillColor))) Graphics.FillPath(brush, Path); }); }
static public void DrawArearGrid(Vector2 minimum, Vector2 maximum, Vector2 cell_size, float y = 0.0f) { Vector3 minimum3 = minimum.GetArear(y); Vector3 maximum3 = maximum.GetArear(y); Floats.Range(minimum.y, maximum.y, cell_size.y, true) .Process(z => Gizmos.DrawLine(minimum3.GetWithZ(z), maximum3.GetWithZ(z))); Floats.Range(minimum.x, maximum.x, cell_size.x, true) .Process(x => Gizmos.DrawLine(minimum3.GetWithX(x), maximum3.GetWithX(x))); }
/// <summary> /// Рисоание контура пути /// </summary> /// <returns></returns> private Action Draw() { var fillColor = Colors.ContainsKey("FillColor") ? Colors["FillColor"] : Color.Black; var fillOpacity = Floats.ContainsKey("FillOpacity") ? (int)Floats["FillOpacity"] : 255; var penWidth = Floats.ContainsKey("PenWidth") ? Floats["PenWidth"] : 1; return(() => { using (var pen = new Pen(Color.FromArgb(fillOpacity, fillColor), penWidth)) Graphics.DrawPath(pen, Path); }); }
public void CopyFrom(ICustomProperties properties) { if (properties == null) { return; } Ints.CopyFrom(properties.Ints); Floats.CopyFrom(properties.Floats); Strings.CopyFrom(properties.Strings); Bools.CopyFrom(properties.Bools); Entities.CopyFrom(properties.Entities); }
//! 视图坐标转为模型坐标 public bool DisplayToModel(Rect rect) { Floats p = new Floats((float)rect.Left, (float)rect.Top, (float)rect.Right, (float)rect.Bottom); bool ret = CoreView.displayToModel(p); rect.X = p.get(0); rect.Y = p.get(1); rect.Width = p.get(2) - rect.X; rect.Height = p.get(3) - rect.Y; return(ret); }
public override bool showContextActions(Ints actions, Floats buttonXY, float x, float y, float w, float h) { hideContextActions(); if (buttonCaptions == null) { buttonCaptions = Resource1.basic_actions.Split(new Char[] { ',' }); } if (actions != null && !createActionImages(actions, buttonXY)) { createActionButtons(actions, buttonXY); } return(isContextActionsVisible()); }
// Updating. private protected override void OnAct(out bool finished) { ValidateContext(); finished = false; // Update time. timeUntilExtinction = Floats.SetPositive(timeUntilExtinction - Context.GameTimeDelta); // Go extinct. if (timeUntilExtinction == 0f) { Context.UnitSystem.PlanAction(new UnitRemovalAction(Owner)); } }
// Constructors. public DirectAttackAbility( NamedId abilityId, NamedId conditionId, Damage singleAttackDamage, float attackDuration, float attackMoment, float attackRange) : base(abilityId) { // Meta. this.conditionId = conditionId; //Attack properties. this.singleAttackDamage = singleAttackDamage; this.attackDuration = Floats.SetPositive(attackDuration); this.attackMoment = Floats.LimitPositive(attackMoment, this.attackDuration); this.attackRange = Floats.SetPositive(attackRange); }
static public Mesh CreateDegreeSector(float start_angle, float end_angle, int number_vertexs) { Mesh mesh = new Mesh(); mesh.vertices = Floats.Line(start_angle, end_angle, number_vertexs - 1, true) .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * 0.5f) .Prepend(new Vector3(0.0f, 0.0f, 0.0f)) .ToArray(); mesh.CalculateTrianglesAsFan(); mesh.RecalculateNormals(); mesh.RecalculateBounds(); return(mesh); }
private void Read(string value) { if (value == null || value.Length == 0) { return; } var x = value.Split(new char[] { '|' }); for (int i = 0; i < x.Length; i++) { if (x[i].Length > 2) { values[Property.GetProperty(x[i].Substring(0, 2))] = Floats.ParseStorage(x[i].Substring(2)); } } }
protected override void GenerateInternal(Rect r) { rect = r; directions = directions = Vector2s.RadialFromDegrees( Floats.Line(0.0f, 360.0f, max_number_branches, false) ).ToList(); active_nodes = new Queue <PathNode2D>(); Seed(origin, Pathfinding2D.GetInstance().GetPotentialClearingRadius(origin)); while (active_nodes.IsNotEmpty()) { GrowPathNode(active_nodes.Dequeue()); } }
public bool GetScoreRank(float score, out int rank, out int outOf) { var scores = new List <Score>(m_oldScores); rank = 0; outOf = scores.Count; scores.Sort((a, b) => b.Int() - a.Int()); for (int i = 0; i < outOf; i++) { if (Floats.EqualsEpsilon(score, scores[i].Value)) { rank = i; return(true); } } return(false); }
public static string getDimensions(int mgView, float[] vars) { Floats v = new Floats(vars.Length); Chars types = new Chars(vars.Length); int n = DemoCmdsGate.getDimensions(mgView, v, types); if (n > 0) { StringBuilder buf = new StringBuilder(n); for (int i = 0; i < n; i++) { buf.Append(v.get(i)); vars[i] = v.get(i); } return(buf.ToString()); } return(""); }
public SerialisableProperties GetSerializableProperties() { return(new SerialisableProperties("reasonablyComplexObject", new List <JsonProperty> { new StringJsonProperty { Key = "name", Value = Name }, new NumericJsonProperty { Key = "count", Value = Count } }, new List <JsonSerialisor> { new JsonArraySerialisor("strings", Strings, JsonPropertyType.Alphabetic), new JsonArraySerialisor("floats", Floats .Select(f => f.ToString(CultureInfo.InvariantCulture)) .AsEnumerable(), JsonPropertyType.Numeric), new JsonPropertiesSerialisor(Level2.GetSerializableProperties()) })); }
public string ToString(Single value, bool round) { // TODO: perhaps this should implement Uncide CLDR rules for other cultures if (round) { if (value > 0 && value <= 1) { return(string.Format("{0} {1}", Floats.ToUIString(value), LocalizedText)); } return(string.Format("{0} {1}", Floats.ToUIString(value), LocalizedMulti)); } else { if (value > 0 && value <= 1) { return(string.Format("{0} {1}", Floats.ToStorageString(value), LocalizedText)); } return(string.Format("{0} {1}", Floats.ToStorageString(value), LocalizedMulti)); } }
public static Amount ParseEquivalent(string text) { try{ if (string.IsNullOrEmpty(text)) { return(Amount.Zero); } if (text.EndsWith("g") || text.EndsWith("ml")) { return(Parse(text)); } if (char.IsNumber(text, text.Length - 1)) { return(FromGram(Floats.ParseStorage(text))); } } catch (Exception ex) { LittleWatson.ReportException(ex, text); } return(Parse(text)); }
private void InitializeParameters() { lightingParameters["light_direction"] = new Floats(3, 3); (lightingParameters["light_direction"] as Floats).Set(0, Vector3.Normalize(new Vector3(1.20f, 1.05, 1.05f))); (lightingParameters["light_direction"] as Floats).Set(1, Vector3.Normalize(new Vector3(1.00f, 1.20, 1.00f))); (lightingParameters["light_direction"] as Floats).Set(2, Vector3.Normalize(new Vector3(1.05f, 1.05, 1.20f))); lightingParameters["light_color"] = new Floats(3, 3); (lightingParameters["light_color"] as Floats).Set(0, 1.0f, 0.9f, 0.6f); (lightingParameters["light_color"] as Floats).Set(1, 0.4f, 0.6f, 1.0f); (lightingParameters["light_color"] as Floats).Set(2, 1.0f, 0.9f, 0.6f); lightingParameters["light_radiance"] = new Floats(1, 3); (lightingParameters["light_radiance"] as Floats).Set(0, 0.75f); (lightingParameters["light_radiance"] as Floats).Set(1, 1.75f); (lightingParameters["light_radiance"] as Floats).Set(2, 0.75f); globalParameters["global_add_color"] = new Floats(0.0f, 0.0f, 0.0f, 0.0f); globalParameters["alpha"] = new Floats(1.0f); globalParameters["exposure"] = new Floats(1.0f); globalParameters["ambient_light_color"] = new Floats(0.23f, 0.43f, 0.53f); }
public override string ToString() { var s = new StringBuilder(); var b = false; foreach (var x in values) { if (b) { s.Append("|"); } else { b = true; } s.Append(x.Key.ID); s.Append(Floats.ToStorageString(x.Value)); } return(s.ToString()); }
public void Parse(AssetsFile file, AssetsObject owner, AssetsReader reader) { var count = reader.ReadInt32(); for (int i = 0; i < count; i++) { TexEnvs.Add(new Map <string, TexEnv>(reader.ReadString(), new TexEnv(file, owner, reader))); } count = reader.ReadInt32(); for (int i = 0; i < count; i++) { Floats.Add(new Map <string, Single>(reader.ReadString(), reader.ReadSingle())); } count = reader.ReadInt32(); for (int i = 0; i < count; i++) { Colors.Add(new Map <string, Color>(reader.ReadString(), new Color(reader))); } }
// Constructors. public DirectAttackCondition( UnitPresentation target, Damage singleAttackDamage, float attackDuration, float attackMoment, float attackRange, NamedId id) { // Meta. this.id = id; // Attack properties. this.target = target ?? throw new ArgumentNullException(nameof(target)); this.singleAttackDamage = singleAttackDamage; this.attackDuration = Floats.SetPositive(attackDuration); this.attackMoment = Floats.LimitPositive(attackMoment, this.attackDuration); this.attackRange = Floats.SetPositive(attackRange); // Progress. accumulatedTime = 0f; attacked = false; atStart = true; }
public static void Main(string [] args) { /* Sum MySum = new Sum(); int total = MySum.sumNumbers(50, 100); Console.WriteLine(total); */ Floats flt = new Floats(); Console.WriteLine("Enter five floating values to find the average"); Console.Write("Float 1: "); flt.f1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Float 2: "); flt.f2 = Convert.ToDouble(Console.ReadLine()); Console.Write("Float 3: "); flt.f3 = Convert.ToDouble(Console.ReadLine()); Console.Write("Float 4: "); flt.f4 = Convert.ToDouble(Console.ReadLine()); Console.Write("Float 5: "); flt.f5 = Convert.ToDouble(Console.ReadLine()); double average = flt.floatAverage(); Console.WriteLine("The average of the floats is " + string.Format("{0:0.00}", average)); }
public virtual bool getViewModelBox(Floats box) { bool ret = touchvgPINVOKE.MgCoreView_getViewModelBox(swigCPtr, Floats.getCPtr(box)); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool getImageSize(Floats info, int sid) { bool ret = touchvgPINVOKE.MgCoreView_getImageSize(swigCPtr, Floats.getCPtr(info), sid); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool getHandlePoint(Floats xy, int shapeId, int index) { bool ret = touchvgPINVOKE.MgCoreView_getHandlePoint(swigCPtr, Floats.getCPtr(xy), shapeId, index); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool getDisplayExtent(int doc, int gs, Floats box) { bool ret = touchvgPINVOKE.MgCoreView_getDisplayExtent__SWIG_1(swigCPtr, doc, gs, Floats.getCPtr(box)); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool getBoundingBox(int doc, int gs, Floats box, int shapeId) { bool ret = touchvgPINVOKE.MgCoreView_getBoundingBox__SWIG_2(swigCPtr, doc, gs, Floats.getCPtr(box), shapeId); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool displayToModel(Floats d) { bool ret = touchvgPINVOKE.MgCoreView_displayToModel(swigCPtr, Floats.getCPtr(d)); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool showContextActions(Ints actions, Floats buttonXY, float x, float y, float w, float h) { bool ret = (SwigDerivedClassHasMethod("showContextActions", swigMethodTypes5) ? touchvgPINVOKE.GiView_showContextActionsSwigExplicitGiView(swigCPtr, Ints.getCPtr(actions), Floats.getCPtr(buttonXY), x, y, w, h) : touchvgPINVOKE.GiView_showContextActions(swigCPtr, Ints.getCPtr(actions), Floats.getCPtr(buttonXY), x, y, w, h)); if (touchvgPINVOKE.SWIGPendingException.Pending) throw touchvgPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public static int getDimensions(int mgView, Floats vars, Chars types) { int ret = democmdsPINVOKE.DemoCmdsGate_getDimensions(mgView, Floats.getCPtr(vars), Chars.getCPtr(types)); if (democmdsPINVOKE.SWIGPendingException.Pending) throw democmdsPINVOKE.SWIGPendingException.Retrieve(); return ret; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Floats obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }