SilverScreen Solid Modeler

SS_COEF

SS_COEF

Previous topic Next topic  

SS_COEF

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

SilverSharp.SS_COEF

 

Structure

The SilverSharp.SS_COEF object represents a plane equation of the form Ax + By + Cz + D = 0

 

C# Code

 

 class SS_COEF

    {

    SS_COEF();

    SS_COEF(double a, double b, double c, double d);

    SS_COEF(SS_COEF plane);

 

    string ToString();

    string ToString(Notation notation, UnitsOfMeasure measure);

 

    property double a   { get; set; }

    property double b   { get; set; }

    property double c   { get; set; }

    property double d   { get; set; }

    property SS_XYZ abc { get; set; }

 

    static SS_COEF operator * (SS_COEF lhs, double rhs);

    static SS_COEF operator / (SS_COEF lhs, double rhs);

   

    SS_COEF operator *= (double rhs);

    SS_COEF operator /= (double rhs);

 

    void     Clear();

    double   GetMagnitude();

    bool     SetMagnitude(double desired_magnitude);

    bool     Normalize();

 

    static bool IsNull(SS_COEF Plane);

    };

 

 

 

Operator overrides

Operator

Description

SS_COEF operator *

Multiplies a plane equation by a value and returns the result

SS_COEF operator /

Divides a plane equation by a value and returns the result

SS_COEF operator *=

Multiplies a plane equation by a value and stores the result in the object

SS_COEF operator /=

Divides a plane equation by a value and stores the result in the object

 

The following code shows how to make use of the operator overrides. The code below is illustrative and does not perform useful work:

 

C# Code

 

 using SilverSharp;

 

 . . .

 

 SS_COEF xy = new SS_COEF(0.0, 0.0, 5.0, 0.0);

 SS_COEF yz = new SS_COEF(1.0, 0.0, 0.0, 0.0);

 

 xy /= 5.0;

 yz *= 8.0;

 

 SS_COEF p1 = xy * 2.0;

 SS_COEF p2 = yz / 2.0;

 

 

 

Properties

Name

Description

a

Read + Write property to get/set the A component of plane equation

b

Read + Write property to get/set the B component of plane equation

c

Read + Write property to get/set the C component of plane equation

d

Read + Write property to get/set the D component of plane equation

abc

Read + Write property to get/set the A, B, and C component of plane equation as a 3D point. This is referred to as the plane normal or a direction vector.

 

The following code shows how to make use of the properties in order to test if a point is on a plane:

 

C# Code

 

 using SilverSharp;

 

 . . .

 

 SS_COEF coef = new SS_COEF(1.0, 2.0, 3.0, 4.0);

 

 SS_COEF point = new SS_XYZ (3.0, 3.0, 0.0);

 double  tval;

 

 coef.Normalize();

 

 tval = (coef.a * point.x) +   // Ax +

        (coef.b * point.y) +   // By +

        (coef.c * point.z) +   // Cz +

        coef.d;                // D

 

 if ( SC.zero_double(tval) )

    SC.error_message("The point is on the plane");

 

 

 

Methods

Member

Description

Clear

Sets all components of plane equation to zero

GetMagnitude

Gets length of plane normal

IsNull

Tests a reference to see if it is a null reference

Normalize

Scales plane normal so its length is 1

SetMagnitude

Scales plane normal to a length

SS_COEF

Constructors to initialize the object

ToString

Formats the SS_COEF as a string

 

 

See Also

get_plane, point_on_plane