/*============================================================================= Project: SharpImage Module: siTubeSpatialObjectPoint.cs Language: C# Author: Dan Mueller Date: $Date: 2007-07-06 10:57:00 +1000 (Fri, 06 Jul 2007) $ Revision: $Revision: 2 $ Copyright (c) Queensland University of Technology (QUT) 2007. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =============================================================================*/ using System; using System.Collections.Generic; using System.Text; namespace SharpImage.SpatialObject { public class siTubeSpatialObjectPoint { #region Constants //===================================================================== protected const uint Dimension = 3; //===================================================================== #endregion #region Instance Variables //===================================================================== //===================================================================== #endregion #region Construction and Disposal //===================================================================== /// /// Protected constructor. /// protected siTubeSpatialObjectPoint() { } /// /// Static factory constructor. /// /// public static siTubeSpatialObjectPoint New() { return new siTubeSpatialObjectPoint(); } /// /// Parses an siTubeSpatialObjectPoint from a line in the following format: /// "x y z r v1x v1y v1z v2x v2y v2z tx ty tz red green blue alpha id" /// /// /// public static siTubeSpatialObjectPoint Parse(string line) { try { // Clean up input line = line.Trim(' ', '\r', '\n'); // Split based on space string[] split = line.Split(' '); // Create empty point siTubeSpatialObjectPoint result = new siTubeSpatialObjectPoint(); // Parse Position result.m_Position[0] = Double.Parse(split[0]); result.m_Position[1] = Double.Parse(split[1]); result.m_Position[2] = Double.Parse(split[2]); // Parse Radius result.m_Radius = Double.Parse(split[3]); // Parse Normal1 result.m_Normal1[0] = Double.Parse(split[4]); result.m_Normal1[1] = Double.Parse(split[5]); result.m_Normal1[2] = Double.Parse(split[6]); // Parse Normal2 result.m_Normal2[0] = Double.Parse(split[7]); result.m_Normal2[1] = Double.Parse(split[8]); result.m_Normal2[2] = Double.Parse(split[9]); // Parse Tangent result.m_Tangent[0] = Double.Parse(split[10]); result.m_Tangent[1] = Double.Parse(split[11]); result.m_Tangent[2] = Double.Parse(split[12]); // Return return result; } catch { return null; } } //===================================================================== #endregion #region Properties //===================================================================== #region Position //===================================================================== private itk.itkPoint m_Position = new itk.itkPoint(siTubeSpatialObjectPoint.Dimension); /// /// Gets the position of the point. /// public itk.itkPoint Position { get { return this.m_Position; } } //===================================================================== #endregion #region Radius //===================================================================== private double m_Radius = 0.0; /// /// Gets the radius of the tubular cross-section. /// public double Radius { get { return this.m_Radius; } } //===================================================================== #endregion #region Tangent //===================================================================== private itk.itkVector m_Tangent = new itk.itkVector(siTubeSpatialObjectPoint.Dimension); /// /// Gets the tangent of the point. /// public itk.itkVector Tangent { get { return this.m_Tangent; } } //===================================================================== #endregion #region Normal1 //===================================================================== private itk.itkVector m_Normal1 = new itk.itkVector(siTubeSpatialObjectPoint.Dimension); /// /// Gets the Normal1 of the point. /// public itk.itkVector Normal1 { get { return this.m_Normal1; } } //===================================================================== #endregion #region Normal2 //===================================================================== private itk.itkVector m_Normal2 = new itk.itkVector(siTubeSpatialObjectPoint.Dimension); /// /// Gets the Normal2 of the point. /// public itk.itkVector Normal2 { get { return this.m_Normal2; } } //===================================================================== #endregion //===================================================================== #endregion #region Public Methods //===================================================================== public override string ToString() { return "Position=" + this.Position.ToString() + " Radius=" + this.Radius.ToString(); } //===================================================================== #endregion #region Private Methods //===================================================================== //===================================================================== #endregion } }