﻿ SS_XYZ
SilverScreen Solid Modeler

# SS_XYZ  # SS_XYZ    # SilverSharp.SS_XYZ

The SS_XYZ structure represents a 3D point and it has methods convenient to a 3D point.

 C# Code struct SS_XYZ     {     double x;     double y;     double z;       SS_XYZ(double xval, double yval, double zval);               static SS_XYZ operator - (SS_XYZ lhs);     static SS_XYZ operator - (SS_XYZ lhs, SS_XYZ rhs);     static SS_XYZ operator + (SS_XYZ lhs, SS_XYZ rhs);     static SS_XYZ operator * (SS_XYZ lhs, double rhs);     static SS_XYZ operator / (SS_XYZ lhs, double rhs);       string ToString();     string ToString(Notation notation, UnitsOfMeasure measure);       double GetMagnitude();     double GetMagnitudeSquared();     bool   SetMagnitude(double desired_magnitude);     bool   Normalize();     void   Clear();     };

Properties

 Name Description x x-coordinate value y y-coordinate value z z-coordinate value

Operator overrides

 Operator Description SS_XYZ operator - The unary minus operator negates all 3 coordinates of a 3D point, and the subtraction operator subtracts all 3 coordinates of one 3D point from another SS_XYZ operator + Adds all 3 coordinates of one 3D point to another SS_XYZ operator * Multiplies all 3 coordinates of a 3D point by a floating-point value SS_XYZ operator / Divides all 3 coordinates of a 3D point by a floating-point value

The following code shows how to make use of the operator overrides. The SilverScreen API contains functions such as xyz_add, xyz_sub, xyz_mult, and xyz_div to do the same work.

 C# Code SS_XYZ p1 = new SS_XYZ(1.0,0.0,0.0);  SS_XYZ p2 = new SS_XYZ(2.0,0.0,0.0);  SS_XYZ p3;    p3 = - p1;               // p3 becomes -1,0,0  p3 = p1 + p2;        // p3 becomes 3,0,0  p3 = p2 - p1;        // p3 becomes 1,0,0  p3 = p1 * 5;         // p3 becomes 5,0,0  p3 = (p1 + p2) / 2;  // p3 becomes 1.5,0,0

Methods

 Name Description Clear Set all coordinate values to 0.0 GetMagnitude Get the distance of the 3D point from the origin GetMagnitudeSquared Get the squared distance of the 3D point from the origin Normalize Move the 3D point one unit of directed-distance from the origin SetMagnitude Move the 3D point a directed-distance from the origin SS_XYZ Constructor to initialize the object ToString Format the SS_XYZ as a string