﻿ Geometries > SG_SPLINE

SG_SPLINE class

The SG_SPLINE structure is a presentation of the Bezier spline in the three-dimensional space.

Has the following fields

SG_POINT*    m_points;   -  array of spline points approximated by line segments

int                     m_points_count; - number of approximation points

SG_POINT*    m_knots;   -   array of spline knots

int                     m_knots_count; - number of spline knots

Has the following methods:

static   SG_SPLINE*   Create();

Description:

The virtual class constructor. The SG_SPLINE::SG_SPLINE() constructor is closed, so that memory allocation for a spline and its deletion can take place with the means of the sgCore library. That's why you can create a spline only using the Create() static function. You must delete the spline after using it by calling the Delete(SG_SPLINE*) static function.

Arguments:

No arguments.

Returned value:

Returns the pointer to an empty spline which you must fill using the following functions AddKnot(), DeleteKnot(), MoveKnot().

static   void   Delete(SG_SPLINE* spl);

Description:

Deletes the spline previously created using the Create() function.

Arguments:

spl - a spline to be deleted

Returned value:

No values.

bool   AddKnot(const SG_POINT& pnt, int nmbr);

Description:

Adds a knot to the spline

Arguments:

pnt - a new knot

nmbr - knot number.

Returned value:

If the knot is successfully added the function returns true, otherwise false

bool   MoveKnot(int nmbr, const SG_POINT& pnt);

Description:

Moves a knot in the spline

Arguments:

pnt - new knot location

nmbr - knot number.

Returned value:

If the knot is successfully moved the function returns true, otherwise false

bool   DeleteKnot(int nmbr);

Description:

Deletes a knot from the spline

Arguments:

nmbr - knot number.

Returned value:

If the knot is successfully removed the function returns true, otherwise false

bool   IsClosed();

Description:

Checks whether the spline is closed

Arguments:

No arguments.

Returned value:

If the spline is closed the function returns true, otherwise false

bool   Close();

Description:

Closes the spline.

Arguments:

No arguments.

Returned value:

If the spline has been successfully closed the function returns true, otherwise false

bool UnClose(int nmbr);

Description:

Uncloses the closed spline by a specified knot.

Arguments:

nmbr - number of the knot to unclose the spline by.

Returned value:

If the spline has been successfully unclosed the function returns true, otherwise false

const   SG_POINT* GetPoints() const;

Description:

Returns the pointer to the array of the spline appoximation points.

Arguments:

No arguments.

Returned value:

The function Returns the pointer to the array of the spline appoximation points.

int GetPointsCount() const;

Description:

Returns a number of the spline approximation points.

Arguments:

No arguments.

Returned value:

The function returns a number of the spline approximation points.

const   SG_POINT* GetKnots() const;

Description:

Returns the pointer to the array of the spline knots.

Arguments:

No arguments.

Returned value:

The function Returns the pointer to the array of the spline knots.

const   SG_POINT* GetKnotsCount() const;

Description:

Returns the number of spline knots.

Arguments:

No arguments.

Returned value:

The function returns the number of spline knots.

Defined in sg2D.h