SilverScreen Solid Modeler

Normalize method

Normalize method

Previous topic Next topic  

Normalize method

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

bool Normalize();

 

 

 

 

 




Synopsis

#include "silver.h"

 

The Normalize method  moves the 3D point along a directed vector through the origin such that its' magnitude becomes 1

 

 

Parameters

none

 

 

Return Value

Normalize returns true if successful, and false otherwise.

 

 

Remarks

Normalize is always successful unless the 3D point being operated upon is the origin (0,0,0).

 

 

See Also

SS_XYZ

 

 

Example

The following code will create a point, p3, that is 5 units from p1 along the line formed between p1 and p2:

 

C# Code

 

 using SilverSharp;

 

 SS_XYZ p1 = new SS_XYZ(12.0, 15.0, 0.0);

 SS_XYZ p2 = new SS_XYZ(20.0, 17.5. 0.0);

 SS_XYZ direction = p2 - p1;

 

 direction.Normalize();  // Direction vector has length = 1

 

 SS_XYZ p3 = p1 + (direction * 5.0);

 

 

Note: The SilverScreen API routine follow_vector can perform the above calculations more easily.