public void addScaledVector(MyVector3 vector, real scale) { MyQuaternion q = new MyQuaternion(0, vector.x * scale, vector.y * scale, vector.z * scale); q *= this; r += q.r * ((real)0.5); i += q.i * ((real)0.5); j += q.j * ((real)0.5); k += q.k * ((real)0.5); }
public void ReplyTest() { bridgeForum forum = new real(); Rooney(forum); forum.addPost("Manchester United", "Champ19ns", "thropy", "i got my 10 thropy", "vida", "15"); forum.reply("Manchester United", "Champ19ns", "i got my 10 thropy", "assists", "and i have 5", "wazza", "10"); IList <string> lst = forum.AllPostreplies("Manchester United", "Champ19ns", "i got my 10 thropy", "wazza", "10"); Assert.AreEqual(lst.Count, 1, 0, "there is only one reply"); //Assert.AreEqual(lst.Exists(element => element.Equals("and i have 5")), true, "assists is only one reply"); RooneyDis(forum); }
public void CreateSubForumTest() { bridgeForum forum = new real(); Rooney(forum); List <string> lst = forum.subForumList("Manchester United"); Assert.AreEqual(lst.Count, 1, 0, "there is only one sub forum"); Assert.AreEqual(lst.Exists(element => element.Equals("Champ19ns")), true, "Champ19ns is only one sub"); bool b = forum.createSubForum("Manchester United", "Champions 20", "new record: 19 primer league titles", "vida", "wazza", "10"); Assert.AreEqual(b, false, "wazza cant create sub forum"); }
public void InitTest() //use case 1 { bridgeForum system = new real(); system.init("Ferguson", "scottishAccent", "alex@fer", "fergi", "england.manchster"); // allowed to perform actions after initialization Boolean added = system.createForum("Ferguson", "scottishAccent", "First Forum", 2); Assert.IsTrue(added); added = system.createSubForum("First Forum", "First Thread", "SubForumSubject", "", "Ferguson", "scottishAccent"); Assert.IsTrue(added); }
public void setAwake(bool awake = true) { if (awake) { isAwake = true; motion = sleepEpsilon * 2.0f; } else { isAwake = false; velocity.Clear(); rotation.Clear(); } }
public void AnonymousConnectTest() { bridgeForum system = new real(); system.init("Ferguson", "scottishAccent", "*****@*****.**", "alex ferguson", "england.manchster"); system.createForum("Ferguson", "scottishAccent", "First Forum", 2); system.createSubForum("First Forum", "First Thread", "SubForumSubject", "", "Ferguson", "scottishAccent"); system.createSubForum("First Forum", "Second Thread", "SubForumSubject2", "", "Ferguson", "scottishAccent"); IList <string> listSubForums = system.subForumList("First Forum"); IList <string> recievedSubForums = system.anonymousConnect("First Forum"); Assert.AreEqual(recievedSubForums.Count, 2, "guest recieved a list of two sub forums"); // Assert.IsTrue(listSubForums.Equals(recievedSubForums)); }
public void DeletePostTest() { bridgeForum forum = new real(); Rooney(forum); forum.addPost("Manchester United", "Champ19ns", "thropy", "i got my 10 thropy", "vida", "15"); forum.deletePost("wazza", "10", "Manchester United", "Champ19ns", "thropy", "i got my 10 thropy"); Assert.AreEqual(forum.postsList("Manchester United", "Champ19ns").Count, 1, 0, "normal member cant remove this post"); forum.addPost("Manchester United", "Champ19ns", "assists", "i am with 19 asissts", "wazza", "10"); forum.deletePost("wazza", "10", "Manchester United", "Champ19ns", "assists", "i am with 19 asissts"); Assert.AreEqual(forum.postsList("Manchester United", "Champ19ns").Count, 1, 0, "normal member remove his post"); forum.deletePost("giggsy", "11", "Manchester United", "Champ19ns", "thropy", "i got my 10 thropy"); Assert.AreEqual(forum.postsList("Manchester United", "Champ19ns").Count, 0, 0, "giggsy can do everything"); RooneyDis(forum); }
public static boolean IsUnitInRangeLoc(unit whichUnit, location whichLocation, real distance) { real xs = whichUnit.x - whichLocation.x; real ys = whichUnit.y - whichLocation.y; real d = (real)Math.Sqrt(xs * xs + ys * ys); if (distance >= d) { return(true); } else { return(false); } }
public static boolean IsUnitInRangeXY(unit whichUnit, real x, real y, real distance) { real xs = whichUnit.x - x; real ys = whichUnit.y - y; real d = (real)Math.Sqrt(xs * xs + ys * ys); if (distance >= d) { return(true); } else { return(false); } }
public void DeleteCommentPostTest() { bridgeForum forum = new real(); Rooney(forum); forum.addPost("Manchester United", "Champ19ns", "assists", "i am with 19 asissts", "wazza", "10"); forum.reply("Manchester United", "Champ19ns", "i am with 19 asissts", "a", "and 20 goals", "wazza", "10"); IList <string> lst = forum.AllPostreplies("Manchester United", "Champ19ns", "i am with 19 asissts", "wazza", "10"); Assert.AreEqual(1, lst.Count, "there is one comment"); forum.deletePost("wazza", "10", "Manchester United", "Champ19ns", "a", "and 20 goals"); IList <string> lst1 = forum.AllPostreplies("Manchester United", "Champ19ns", "i am with 19 asissts", "wazza", "10"); Assert.AreEqual(0, lst1.Count, "there is no comments"); RooneyDis(forum); }
public void MailConfirmTest() { bridgeForum forum = new real(); Rooney(forum); forum.addPost("Manchester United", "Champ19ns", "thropy", "i got my 10 thropy", "vida", "15"); List <string> lst = forum.subForumPosts("wazza", "10", "Manchester United", "Champ19ns"); Assert.AreEqual(lst.Count, 1, 0, "there is only one post"); Int64 i = forum.register("Manchester United", "wazza", "10", "wayne rooney", "*****@*****.**"); forum.mailConfirm("wazza", "10", "Manchester United", i); Assert.IsFalse(forum.memberConnect("Manchester United", "wazza", "10")); RooneyDis(forum); }
public void PromoteMemberToModeratorTest() { bridgeForum forum = new real(); Rooney(forum); List <string> lst = forum.subForumModerators("giggsy", "11", "Manchester United", "Champ19ns"); Assert.AreEqual(lst.Count, 1, 0, "there is only one moderator"); Assert.AreEqual(lst.Exists(element => element.Equals("vida")), true, "vida is only one moderator"); forum.promoteMemberToModerator("giggsy", "11", "Manchester United", "wazza", "Champ19ns"); lst = forum.subForumModerators("giggsy", "11", "Manchester United", "Champ19ns"); Assert.AreEqual(lst.Count, 2, 0, "now there is two moderators"); Assert.AreEqual(lst.Exists(element => element.Equals("wazza")), true, "wazza is one of them moderator"); RooneyDis(forum); }
public void normalise() { real d = r * r + i * i + j * j + k * k; if (d < Mathf.Epsilon) { r = 1; return; } d = ((real)1.0) / Mathf.Sqrt((float)d); r *= d; i *= d; j *= d; k *= d; }
public void ChangePolicyTest() { bridgeForum system = new real(); system.init("Ferguson", "scottishAccent", "alex@fer", "fergi", "england.manchster"); system.createForum("Ferguson", "scottishAccent", "First Forum", 2); Boolean changed = true;//system.changePolicy("Ferguson", "scottishAccent", "First Forum", 1); Assert.IsTrue(changed); changed = false;// system.changePolicy("Ferguson", "wrong pass", "First Forum", 1); // wrong password-> wont change policy Assert.IsFalse(changed); system.register("First Forum", "user1", "I Hate Football", "Ronaldo", "*****@*****.**"); changed = false; //system.changePolicy("user1", "I Hate Football", "First Forum", 1); // simple member-> wont change policy Assert.IsFalse(changed); }
public RigidBody() { this.inverseMass = new real(); this.inverseInertiaTensor = new Matrix3(); this.linearDamping = new real(); this.angularDamping = new real(); this.position = new MyVector3(); this.orientation = new MyQuaternion(); this.velocity = new MyVector3(); this.rotation = new MyVector3(); this.inverseInertiaTensorWorld = new Matrix3(); this.motion = new real(); this.isAwake = new bool(); this.canSleep = new bool(); this.transformMatrix = new Matrix4(); this.forceAccum = new MyVector3(); this.torqueAccum = new MyVector3(); this.acceleration = new MyVector3(); this.lastFrameAcceleration = new MyVector3(); }
public void Read_type() { this.PLC.ReadClass(this, this.DB, this.DBB); try { real real_tag = this.rte.real.Find(this.DB, this.DBB); { real_tag.Value = this.value; real_log rl = new real_log { name = real_tag.name, value = (float)real_tag.Value, TIME = DateTime.Now, }; rte.real_log.Add(rl); this.rte.SaveChanges(); } }catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); } }
/** * Integrates the rigid body forward in time by the given amount. * This function uses a Newton-Euler integration method */ public void integrate(real duration) { if (!isAwake) { return; } lastFrameAcceleration = acceleration; lastFrameAcceleration.AddScaledVector(forceAccum, inverseMass); MyVector3 angularAcceleration = inverseInertiaTensorWorld.transform(torqueAccum); velocity.AddScaledVector(lastFrameAcceleration, duration); rotation.AddScaledVector(angularAcceleration, duration); velocity *= Mathf.Pow((float)linearDamping, (float)duration); rotation *= Mathf.Pow((float)angularDamping, (float)duration); position.AddScaledVector(velocity, duration); orientation.addScaledVector(rotation, duration); calculateDerivedData(); clearAccumulators(); if (canSleep) { real currentMotion = velocity.ScalarProduct(velocity) + rotation.ScalarProduct(rotation); real bias = Mathf.Pow(0.5f, (float)duration); motion = bias * motion + (1 - bias) * currentMotion; if (motion < sleepEpsilon) { setAwake(false); } else if (motion > 10 * sleepEpsilon) { motion = 10 * sleepEpsilon; } } }
public void SubForumListTest() { bridgeForum forum = new real(); forum.init("Ferguson", "scottishAccent", "*****@*****.**", "alex ferguson", "england.manchster"); forum.SPlogin("Ferguson", "scottishAccent"); forum.createForum("Ferguson", "scottishAccent", "Manchester United", 5); Int64 i = forum.register("Manchester United", "giggsy", "11", "ryan giggs", "*****@*****.**"); forum.mailConfirm("giggsy", "11", "Manchester United", i); i = forum.register("Manchester United", "vida", "15", "Nemanja Vidić", "*****@*****.**"); forum.mailConfirm("vida", "15", "Manchester United", i); forum.memberConnect("Manchester United", "Ferguson", "scottishAccent"); forum.promoteMemberToAdmin("Ferguson", "scottishAccent", "Manchester United", "giggsy"); forum.memberConnect("Manchester United", "giggsy", "11"); forum.memberConnect("Manchester United", "vida", "15"); forum.createSubForum("Manchester United", "Champ19ns", "new record: 19 primer league titles", "vida", "giggsy", "11"); IList <string> lst = forum.subForumList("Manchester United"); Assert.AreEqual(lst.Count, 1, 0, "there is only one sub forum"); //Assert.AreEqual(lst.Exists(element => element.Equals("Champ19ns")), true, "Champ19ns is only one sub"); }
static void Main(string[] args) { bridgeForum forum = new real(); forum.init("Ferguson", "scottishAccent", "*****@*****.**", "alex ferguson", "england.manchster"); forum.createForum("Ferguson", "scottishAccent", "Manchester United", 5); Int64 i = forum.register("Manchester United", "giggsy", "11", "ryan giggs", "*****@*****.**"); forum.mailConfirm("giggsy", "11", "Manchester United", i); i = forum.register("Manchester United", "vida", "15", "Nemanja Vidić", "*****@*****.**"); forum.mailConfirm("vida", "15", "Manchester United", i); forum.memberConnect("Manchester United", "Ferguson", "scottishAccent"); forum.promoteMemberToAdmin("Ferguson", "scottishAccent", "Manchester United", "giggsy"); forum.memberConnect("Manchester United", "giggsy", "11"); forum.memberConnect("Manchester United", "vida", "15"); forum.createSubForum("Manchester United", "Champ19ns", "new record: 19 primer league titles", "vida", "giggsy", "11"); i = forum.register("Manchester United", "wazza", "10", "wayne rooney", "*****@*****.**"); forum.mailConfirm("wazza", "10", "Manchester United", i); forum.memberConnect("Manchester United", "wazza", "10"); forum.addPost("Manchester United", "Champ19ns", "thropy", "i got my 10 thropy", "vida", "15"); forum.deletePost("wazza", "10", "Manchester United", "Champ19ns", "thropy", "i got my 10 thropy"); // Assert.AreEqual(forum.postsList("Manchester United", "Champ19ns").Count, 1, 0, "normal member cant remove this post"); forum.addPost("Manchester United", "Champ19ns", "assists", "i am with 19 asissts", "wazza", "10"); forum.deletePost("wazza", "10", "Manchester United", "Champ19ns", "assists", "i am with 19 asissts"); int x = forum.postsList("Manchester United", "Champ19ns").Count; // Assert.AreEqual(x, 1, "normal member remove his post"); forum.deletePost("giggsy", "11", "Manchester United", "Champ19ns", "thropy", "i got my 10 thropy"); // Assert.AreEqual(forum.postsList("Manchester United", "Champ19ns").Count, 0, 0, "giggsy can do everything"); forum.memberDisConnect("Manchester United", "wazza", "10"); forum.memberDisConnect("Manchester United", "vida", "15"); forum.memberDisConnect("Manchester United", "giggsy", "11"); forum.memberDisConnect("Manchester United", "Ferguson", "scottishAccent"); }
public void CreateForumTest() //use case 2 { bridgeForum system = new real(); system.init("Ferguson", "scottishAccent", "alex@fer", "fergi", "england.manchster"); system.createForum("Ferguson", "scottishAccent", "First Forum", 2); List <string> listOfForums = system.forumList(); Assert.AreEqual(listOfForums.Count, 1, 0, "one forum created since initialization, as wanted"); system.createForum("Ferguson", "scottishAccent", "Second Forum", 1); listOfForums = system.forumList(); Assert.AreEqual(listOfForums.Count, 2, 0, "two forums created since initialization, as wanted"); system.createForum("wrongUserName", "scottishAccent", "Third Forum", 2); //wrong user name: should not add forum listOfForums = system.forumList(); Assert.AreEqual(listOfForums.Count, 2, 0, "two forums created since initialization, as wanted"); // check: super manager member in forumro system.createSubForum("First Forum", "First Thread", "SubForumSubject", "", "Ferguson", "scottishAccent"); system.memberConnect("First Forum", "Ferguson", "scottishAccent"); Boolean added = system.addPost("First Forum", "First Thread", "Post subject", "Amir!best rommate ever ;)", "Ferguson", "scottishAccent"); Assert.IsTrue(added); }
public void setAcceleration(real x, real y, real z) { acceleration.x = x; acceleration.y = y; acceleration.z = z; }
public void setRotation(real x, real y, real z) { rotation.x = x; rotation.y = y; rotation.z = z; }
public void setVelocity(real x, real y, real z) { velocity.x = x; velocity.y = y; velocity.z = z; }
public void setPosition(real x, real y, real z) { position.x = x; position.y = y; position.z = z; }
/** * Sets the angular damping for the rigid body. * angularDamping The speed that rotation is shed from * the rigid body. */ public void setAngularDamping(real angularDamping) { this.angularDamping = angularDamping; }
/** * Sets the linear damping for the rigid body. * linearDamping The speed that velocity is shed from * the rigid body. */ public void setLinearDamping(real linearDamping) { this.linearDamping = linearDamping; }
public void setDamping(real linearDamping, real angularDamping) { this.linearDamping = linearDamping; this.angularDamping = angularDamping; }
public void setInverseMass(real inverseMass) { this.inverseMass = inverseMass; }
public void setMass(real mass) { Debug.Assert(mass != 0); this.inverseMass = ((real)1.0) / mass; }
/// <summary> /// Initializes a new instance of the <see cref="ComplexF"/> struct. /// </summary> /// <param name="real">The real part.</param> /// <param name="imaginary">The imaginary part.</param> public ComplexF(float real, float imaginary) => value = new Vector2(real, imaginary);