All pastes #922210 Raw Edit

Unbenannt

public text v1 · immutable
#922210 ·published 2008-02-28 17:20 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ISXNodeGather
{
    class Node
    {
        private double _X;
        private double _Y;
        private double _Z;

        private string _Type;

        public Node()
        {
            _X = 0; _Y = 0; _Z = 0; _Type = string.Empty;
        }

        public Node(double X, double Y, double Z)
        {
            _X = X; _Y = Y; _Z = Z; _Type = string.Empty;
        }

        public Node(double X, double Y, double Z, string Type)
        {
            _X = X; _Y = Y; _Z = Z; _Type = Type;
        }

        public double X
        {
            get { return _X; }
            set { _X = value; }
        }
        
        public double Y
        {
            get { return _Y; }
            set { _Y = value; }
        }

        public double Z
        {
            get { return _Z; }
            set { _Z = value; }
        }

        public string Type
        {
            get { return _Type; }
            set { _Type = value; }
        }

        // distance between this node and another
        public double Distance(Node node)
        {
            return Math.Sqrt(Math.Pow(node.X - this.X, 2) + Math.Pow(node.Y - this.Y, 2));
        }

        // distance between 2 nodes
        public static double Distance(Node node1, Node node2)
        {
            return Math.Sqrt(Math.Pow(node1.X - node2.X, 2) + Math.Pow(node1.Y - node2.X, 2));
        }

    }
}