[C#] Class for everyone that read X, Y, and Z seperately -.-^ menu

User Tag List

Results 1 to 1 of 1
  1. #1
    bigtimt's Avatar Active Member
    Reputation
    41
    Join Date
    Mar 2008
    Posts
    100
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#] Class for everyone that read X, Y, and Z seperately -.-^

    Code:
        public struct Vector
        {
            public Single X, Y, Z;
    
            public Vector(Single X, Single Y, Single Z)
            {
                this.X = X;
                this.Y = Y;
                this.Z = Z;
            }
    
            public Single Size()
            {
                return (Single)Math.Sqrt(X * X + Y * Y + Z * Z);
            }
    
            public Single Size2D()
            {
                return (Single)Math.Sqrt(X * X + Y * Y);
            }
    
            public Single DistanceTo(Vector B)
            {
                return (this - B).Size();
            }
    
            public static Single Distance(Vector A, Vector B)
            {
                return (A - B).Size();
            }
    
            public static Vector operator -(Vector A, Vector B)
            {
                return new Vector(A.X - B.X, A.Y - B.Y, A.Z - B.Z);
            }
    
            public static Vector operator +(Vector A, Vector B)
            {
                return new Vector(A.X + B.X, A.Y + B.Y, A.Z + B.Z);
            }
    
            public static Vector operator *(Vector A, Vector B)
            {
                return new Vector(A.X * B.X, A.Y * B.Y, A.Z * B.Z);
            }
    
            public static Vector operator /(Vector A, Vector B)
            {
                return new Vector(A.X / B.X, A.Y / B.Y, A.Z / B.Z);
            }
    
            public static Vector operator *(Vector A, Single B)
            {
                return new Vector(A.X * B, A.Y * B, A.Z * B);
            }
    
            public static Vector operator /(Vector A, Single B)
            {
                return new Vector(A.X / B, A.Y / B, A.Z / B);
            }
    
            public static Boolean operator ==(Vector A, Vector B)
            {
                return A.X == B.X && A.Y == B.Y && A.Z == B.Z;
            }
    
            public static Boolean operator !=(Vector A, Vector B)
            {
                return A.X != B.X || A.Y != B.Y || A.Z != B.Z;
            }
    
            public String ToString()
            {
                return String.Format("({0}, {1}, {2})", X, Y, Z);
            }
        }

    [C#] Class for everyone that read X, Y, and Z seperately -.-^

Similar Threads

  1. Replies: 2
    Last Post: 04-29-2012, 11:58 AM
  2. Crit Error for everyone that can see you
    By DKsoloer in forum World of Warcraft Exploits
    Replies: 9
    Last Post: 04-28-2011, 01:39 AM
  3. For everyone that I made a sig
    By m0rbidang3l in forum Community Chat
    Replies: 6
    Last Post: 08-30-2007, 05:29 PM
All times are GMT -5. The time now is 05:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search