Table of Contents

Class Ext

Namespace
SearchAThing.OpenGL.Core
Assembly
netcore-opengl-core.dll
public static class Ext
Inheritance
Ext
Inherited Members

Methods

AspectRatio(in Size)

Compute aspect ratio of given Size object.

public static float AspectRatio(this in Size size)

Parameters

size Size

Returns

float

Remarks

If size height is zero returns 1, width / height elsewhere.

AverageColor(IGLLine)

Average color of lines vertexes color.

public static Color AverageColor(this IGLLine line)

Parameters

line IGLLine

Returns

Color

BaseX(in Matrix4x4)

Extract basex (m1[1..3]) from the given world matrix.

public static Vector3 BaseX(this in Matrix4x4 m)

Parameters

m Matrix4x4

Returns

Vector3

BaseY(in Matrix4x4)

Extract basey (m2[1..3]) from the given world matrix.

public static Vector3 BaseY(this in Matrix4x4 m)

Parameters

m Matrix4x4

Returns

Vector3

BaseZ(in Matrix4x4)

Extract basez (m3[1..3]) from the given world matrix.

public static Vector3 BaseZ(this in Matrix4x4 m)

Parameters

m Matrix4x4

Returns

Vector3

BuildVertexPosDict(IGLFigure, float)

From given figure create a vertex position based dictionary suitable to be queries through vertex PositionSignature(Vector3, float).

public static Dictionary<string, List<GLVertex>> BuildVertexPosDict(this IGLFigure figure, float tol)

Parameters

figure IGLFigure

Gl figure which retrieve vertexes.

tol float

Vertex position tolerance to group them.

Returns

Dictionary<string, List<GLVertex>>

Dictionary gl vertex position signature to list of gl vertexes within that position.

BuildVertexPosDict(IEnumerable<IGLFigure>, float)

From given list of figures create a vertex position based dictionary suitable to be queries through vertex PositionSignature(Vector3, float).

public static Dictionary<string, List<GLVertex>> BuildVertexPosDict(this IEnumerable<IGLFigure> figures, float tol)

Parameters

figures IEnumerable<IGLFigure>

Gl figures which retrieve vertexes.

tol float

Vertex position tolerance to group them.

Returns

Dictionary<string, List<GLVertex>>

Dictionary gl vertex position signature to list of gl vertexes within that position.

Center(IGLFigure)

Mean of figure vertexes.

public static Vector3 Center(this IGLFigure figure)

Parameters

figure IGLFigure

Returns

Vector3

Describe(IEnumerable<GLFontChar>, string)

Debugging of GLFontChar to xlsx.
Used in GetFontChars(string, SKFont).

public static void Describe(this IEnumerable<GLFontChar> fontChars, string xlsxPathfilename)

Parameters

fontChars IEnumerable<GLFontChar>
xlsxPathfilename string

DistinctPoints(IEnumerable<Line>, float)

public static IEnumerable<Vector3> DistinctPoints(this IEnumerable<Line> lines, float tol)

Parameters

lines IEnumerable<Line>
tol float

Returns

IEnumerable<Vector3>

DistinctPoints(IList<Line>, float)

From the given set of consecutive lines (from,to not required to be adjacent between) retrieve the sorted points of the line sequence without duplicates.

public static IEnumerable<Vector3> DistinctPoints(this IList<Line> lines, float tol)

Parameters

lines IList<Line>

Input lines.

tol float

Comparision length tolerance.

Returns

IEnumerable<Vector3>

Sorted lines points.

EnsureDetached(IGLVertexManagerObject)

Throws an exception if this object isn't detached from any vertex managers.

public static void EnsureDetached(this IGLVertexManagerObject obj)

Parameters

obj IGLVertexManagerObject

EqualsTol(in Vector2, float, in Vector2?)

States if given vector2 equals (with tolerance) to the given one.

public static bool EqualsTol(this in Vector2 v, float tol, in Vector2? other)

Parameters

v Vector2
tol float
other Vector2?

Returns

bool

EqualsTol(in Vector3, float, in Vector3?)

States if given vector3 equals (with tolerance) to the given one.

public static bool EqualsTol(this in Vector3 v, float tol, in Vector3? other)

Parameters

v Vector3
tol float
other Vector3?

Returns

bool

EqualsTol(in Vector4, float, in Vector4?)

States if given vector4 equals (with tolerance) to the given one.

public static bool EqualsTol(this in Vector4 v, float tol, in Vector4? other)

Parameters

v Vector4
tol float
other Vector4?

Returns

bool

EqualsTol(float, float, float)

States if given number equals (with tolerance) to the given one.

public static bool EqualsTol(this float x, float tol, float y)

Parameters

x float
tol float
y float

Returns

bool

FeasibleTriIntersectionTests<T>(IEnumerable<T>, double, IEnumerable<T>, double)

Find feasible triangle pairs that could intersect by evaluating the SearchAThing.Sci.DiscreteSpace<T> over this set of triangles against the given set of triangles.
Search will be done using GetItemsAt(Vector3D, double) method within given margin parameter factor respect the triangle bbox.

public static IEnumerable<(T tri1, T tri2)> FeasibleTriIntersectionTests<T>(this IEnumerable<T> tris1, double tol, IEnumerable<T> tris2, double margin = 1.2) where T : IGLTriangle

Parameters

tris1 IEnumerable<T>

This triangles.

tol double

Intersection test length comparision tolerance.

tris2 IEnumerable<T>

Other triangles.

margin double

Bbox factor (Default:1.2).

Returns

IEnumerable<(T tri1, T tri2)>

Type Parameters

T

FlipX(in Matrix4x4)

Create a new world matrix copy of the given one but with x flipped ( then also the z ).

public static Matrix4x4 FlipX(this in Matrix4x4 m)

Parameters

m Matrix4x4

Input world matrix.

Returns

Matrix4x4

FlipY(in Matrix4x4)

Create a new world matrix copy of the given one but with y flipped ( then also the z ).

public static Matrix4x4 FlipY(this in Matrix4x4 m)

Parameters

m Matrix4x4

Input world matrix.

Returns

Matrix4x4

FlipZ(in Matrix4x4)

Create a new world matrix copy of the given one but with z flipped ( then also the x ).

public static Matrix4x4 FlipZ(this in Matrix4x4 m)

Parameters

m Matrix4x4

Input world matrix.

Returns

Matrix4x4

Fmt(in Matrix4x4, int, int)

Format to string given matrix.

public static string Fmt(this in Matrix4x4 m, int dec, int width = 10)

Parameters

m Matrix4x4

Input matrix.

dec int

Decimal places to show in formatted string.

width int

Nr. of characters foreach component.

Returns

string

String formatted representation of the matrix.

Fmt(in Vector3)

Invariant representation X Y Z

public static string Fmt(this in Vector3 v)

Parameters

v Vector3

Returns

string

GL(GLPrimitiveType)

Retrieve corresponding Silk.NET gl type from netcore-opengl GLPrimitiveType.

public static PrimitiveType GL(this GLPrimitiveType type)

Parameters

type GLPrimitiveType

Returns

PrimitiveType

GetTriangles(Plate, Color?, Color?, Color?, Color?, bool)

Create 2 triangles from given plate.

Default normal of generated triangles will be in accord between them having:

  • first triangle (P1, P2, P3)
  • second triangle (P3, P4, P1)
public static IEnumerable<GLTriangle> GetTriangles(this Plate plate, Color? color1, Color? color2, Color? color3, Color? color4, bool setTextureST = false)

Parameters

plate Plate

Plate for which create 2 triangles.

color1 Color?

(optional) color to apply to vertex1.

color2 Color?

(optional) color to apply to vertex2.

color3 Color?

(optional) color to apply to vertex3.

color4 Color?

(optional) color to apply to vertex4.

setTextureST bool

If true TextureST will be set in order to map texture on the plate.

Returns

IEnumerable<GLTriangle>

Two triangles.

GetTriangles(Plate, in Color?, bool)

Create 2 triangles from given plate.

Default normal of generated triangles will be in accord between them having:

  • first triangle (P1, P2, P3)
  • second triangle (P3, P4, P1)
public static IEnumerable<GLTriangle> GetTriangles(this Plate plate, in Color? color = null, bool setTextureST = false)

Parameters

plate Plate

Plate for which create 2 triangles.

color Color?

Color to apply to created triangles.

setTextureST bool

If true TextureST will be set in order to map texture on the plate.

Returns

IEnumerable<GLTriangle>

Two triangles.

GreatThanOrEqualsTol(float, float, float)

States if given number great than or equals (with tolerance) to the given one.

public static bool GreatThanOrEqualsTol(this float x, float tol, float y)

Parameters

x float
tol float
y float

Returns

bool

GreatThanTol(float, float, float)

States if given number great than (with tolerance) to the given one.

public static bool GreatThanTol(this float x, float tol, float y)

Parameters

x float
tol float
y float

Returns

bool

Intersect(GLTriangle, float, GLTriangle, out bool)

Retrieve intersection segment if exists between given two triangles.

public static Line? Intersect(this GLTriangle tri1, float tol, GLTriangle tri2, out bool bboxSkipped)

Parameters

tri1 GLTriangle

First triangle.

tol float

Length comparision tolerance.

tri2 GLTriangle

Second triangle.

bboxSkipped bool

True if intersect test skipped due to non intersecting bboxes.

Returns

Line

Intersection line between two triangles or null if no intersection exists.

Intersect(Line, float, GLFigureBase)

Intersect given raycast to given figure primitives.
Given [local] raycast will automatically backwarded to [object] raycast depending on the object matrix of given figure.
RayCastLocal(in Vector2)

public static IEnumerable<RayCastHitTest> Intersect(this Line lraycast, float tol, GLFigureBase figure)

Parameters

lraycast Line

Ray cast [local].

tol float

Length tolerance comparision ( used for point and line primitives match ).

figure GLFigureBase

Figure to test for hit vs. given raycast.

Returns

IEnumerable<RayCastHitTest>

List of hits, at most one foreach figure primitive.

Inverse(in Matrix4x4)

Compute the inverse of the given 4x4 matrix.

public static Matrix4x4 Inverse(this in Matrix4x4 m)

Parameters

m Matrix4x4

Input matrix.

Returns

Matrix4x4

Inverse matrix.

IsAttached(IGLVertexManagerObject)

States if this object is currently attached to a gl vertex manager.

public static bool IsAttached(this IGLVertexManagerObject obj)

Parameters

obj IGLVertexManagerObject

Returns

bool

IsParallel(in Vector3, float, in Vector3)

States if two vectors are parallel.

public static bool IsParallel(this in Vector3 v, float tol, in Vector3 other)

Parameters

v Vector3

This vector.

tol float

Length tolerance (use SearchAThing.Sci.Constants.NormalizedLengthTolerance for normalized vectors).

other Vector3

Other vector.

Returns

bool

True if two vectors are parallel.

LessThanOrEqualsTol(float, float, float)

States if given number less than or equals (with tolerance) to the given one.

public static bool LessThanOrEqualsTol(this float x, float tol, float y)

Parameters

x float
tol float
y float

Returns

bool

LessThanTol(float, float, float)

States if given number less than (with tolerance) to the given one.

public static bool LessThanTol(this float x, float tol, float y)

Parameters

x float
tol float
y float

Returns

bool

LineTo(in Vector3, in Vector3, in Color?)

Create a gl line primitive from given two points.

public static GLLine LineTo(this in Vector3 from, in Vector3 to, in Color? color = null)

Parameters

from Vector3

From position.

to Vector3

To position.

color Color?

(Optional) from, to line vertexes color.

Returns

GLLine

LineV(in Vector3, in Vector3)

Create a line from this point with given extension vector.

public static Line LineV(this in Vector3 from, in Vector3 v)

Parameters

from Vector3

This point.

v Vector3

Extension vector.

Returns

Line

LineV(in Vector3, in Vector3, in Color?)

Create a gl line primitive from given position and vector extension.

public static GLLine LineV(this in Vector3 p, in Vector3 v, in Color? color = null)

Parameters

p Vector3

From position.

v Vector3

Extension vector.

color Color?

(Optional) from, to line vertexes color.

Returns

GLLine

Lines(BBox, Color?)

Create wcs gl lines that represents the given bounding box.

public static IEnumerable<GLLine> Lines(this BBox bbox, Color? color = null)

Parameters

bbox BBox

Bounding box for which create gl lines.

color Color?

(optional) color to apply created gl lines.

Returns

IEnumerable<GLLine>

GL lines.

LoadTexture(GLModel, string)

Load texture from given bitmap pathfilename.

public static GLTexture2D LoadTexture(this GLModel model, string pathfilename)

Parameters

model GLModel

Gl model into which load the texture.

pathfilename string

Texture bitmap pathfilename.

Returns

GLTexture2D

Gl texture 2d object.

MRound(float, float)

Round given number using the multiple basis.

public static float MRound(this float value, float multiple)

Parameters

value float
multiple float

Returns

float

Magnitude(float)

Retrieve the magnitude of given number.

public static int Magnitude(this float value)

Parameters

value float

Returns

int

MakeFigure(BBox, in Color?)

Create wcs lines figure that represents the given bounding box.

public static GLLineFigure MakeFigure(this BBox bbox, in Color? color)

Parameters

bbox BBox

Bounding box for which create line figures.

color Color?

(optional) color to apply created figure.

Returns

GLLineFigure

Lines figure.

Max(in Vector3)

Retrieve the maxest component between x, y, z of given vector3.

public static float Max(this in Vector3 v)

Parameters

v Vector3

Returns

float

Move(in Matrix4x4, in Vector3?)

Create a new world matrix copy of the given one but with origin moved of given delta.

public static Matrix4x4 Move(this in Matrix4x4 m, in Vector3? delta = null)

Parameters

m Matrix4x4

Input world matrix.

delta Vector3?

Delta to apply to the origin.

Returns

Matrix4x4

Origin moved world matrix.

Move(in Matrix4x4, float, float, float)

Create a new world matrix copy of the given one but with origin moved of given delta.

public static Matrix4x4 Move(this in Matrix4x4 m, float dx, float dy, float dz)

Parameters

m Matrix4x4

Input world matrix.

dx float

Delta (x) to apply to the origin.

dy float

Delta (y) to apply to the origin.

dz float

Delta (z) to apply to the origin.

Returns

Matrix4x4

Origin moved world matrix.

Move<T>(IEnumerable<T>, Vector3, bool)

Move given figures by the given delta.

public static IEnumerable<T> Move<T>(this IEnumerable<T> figures, Vector3 coord, bool relative = true) where T : IGLFigure

Parameters

figures IEnumerable<T>

Figures to move.

coord Vector3

Delta vector3 [object]

relative bool

If true (default) sum the given delta elsewhere replace the object matrix translation.

Returns

IEnumerable<T>

This figure reference.

Type Parameters

T

Remarks

  • No vertex change, but only the object matrix associated to this figure.
  • Object matrix will replaced with a single translation.

Move<T>(T, in Vector3, bool)

Move the figure by the given delta.

public static T Move<T>(this T figure, in Vector3 coord, bool relative = true) where T : IGLFigure

Parameters

figure T

Figure to move.

coord Vector3

Delta vector3 [object]

relative bool

If true (default) sum the given delta elsewhere replace the object matrix translation.

Returns

T

This figure reference.

Type Parameters

T

Remarks

  • No vertex change, but only the object matrix associated to this figure.
  • Object matrix will replaced with a single translation.

Move<T>(T, float, float, float, bool)

Move the figure by the given delta.

public static T Move<T>(this T figure, float dx, float dy, float dz, bool relative = true) where T : IGLFigure

Parameters

figure T

Figure to move.

dx float

Delta (x) [object]

dy float

Delta (y) [object]

dz float

Delta (z) [object]

relative bool

If true (default) sum the given delta elsewhere replace the object matrix translation.

Returns

T

This figure reference.

Type Parameters

T

Remarks

  • No vertex change, but only the object matrix associated to this figure.
  • Object matrix will replaced with a single translation.

Normalized(in Vector3)

Normalize given vector.

public static Vector3 Normalized(this in Vector3 v)

Parameters

v Vector3

Returns

Vector3

OBBox(IEnumerable<GLFigureBase>)

Object space bbox of given figures vertexes.

public static BBox OBBox(this IEnumerable<GLFigureBase> figures)

Parameters

figures IEnumerable<GLFigureBase>

Gl figures to compute bbox.

Returns

BBox

Figures bbox [object].

Origin(in Matrix4x4)

Extract the origin (m4[1..3]) from the given world matrix.

public static Vector3 Origin(this in Matrix4x4 m)

Parameters

m Matrix4x4

Returns

Vector3

PositionSignature(IGLVertex, float)

Retrieve vertex position signature within given tolerance.

public static string PositionSignature(this IGLVertex glVertex, float tol)

Parameters

glVertex IGLVertex
tol float

Returns

string

PositionSignature(Vector3, float)

Retrieve vector3 position signature within given tolerance.

public static string PositionSignature(this Vector3 position, float tol)

Parameters

position Vector3
tol float

Returns

string

Project(in Vector3, in Matrix4x4)

Project this vector to given xy plane.

public static Vector3? Project(this in Vector3 v, in Matrix4x4 xyPlane)

Parameters

v Vector3

Vector to project.

xyPlane Matrix4x4

XY plane which project the vector into.

Returns

Vector3?

Projected vector.

Project(in Vector3, in Vector3)

Project this vector to the other given.
References: https://en.wikipedia.org/wiki/Vector_projection

public static Vector3 Project(this in Vector3 v, in Vector3 other)

Parameters

v Vector3

Vector to project.

other Vector3

Receiving projection vector.

Returns

Vector3

Projection point if any on the other vector.

SaveTo(SKBitmap, string, SKEncodedImageFormat, int)

Helper method to save skia bitmap to output image file.

public static void SaveTo(this SKBitmap bitmap, string outputPathfilename, SKEncodedImageFormat format = SKEncodedImageFormat.Png, int quality = 80)

Parameters

bitmap SKBitmap
outputPathfilename string
format SKEncodedImageFormat
quality int

ScaleAbout(in Vector3, in Vector3, float)

Scale given vector respect given origin by the given scale factor.

public static Vector3 ScaleAbout(this in Vector3 v, in Vector3 origin, float factor)

Parameters

v Vector3

Vector to scale.

origin Vector3

Reference point.

factor float

Scale factor.

Returns

Vector3

Scaled vector.

Segments(IGLTriangle)

Retrieve gl triangle segments {v1,v2},{v2,v3},{v3,v1} [object].

public static IEnumerable<Line> Segments(this IGLTriangle tri)

Parameters

tri IGLTriangle

Returns

IEnumerable<Line>

SetAlphaF(in Color, float)

Set alpha channel
Alpha=1 (full opaque).
Alpha=0 (full transparent).

public static Color SetAlphaF(this in Color color, float alpha)

Parameters

color Color
alpha float

Returns

Color

SetAlpha<T>(T, float?)

Set figure alpha ( 0:full transparent, 1:full opaque ).

Alpha

Figure on which operate. Alpha (0:transparent, 1:opaque).
public static T SetAlpha<T>(this T fig, float? alpha) where T : IGLFigure

Parameters

fig T
alpha float?

Returns

T

Type Parameters

T

SetColor(IGLVertex, in Color)

Change the color of the vertex.

public static IGLVertex SetColor(this IGLVertex vertex, in Color color)

Parameters

vertex IGLVertex

Vertex which change the color.

color Color

Color to apply.

Returns

IGLVertex

SetColor(IGLVertex, in Vector4)

Change the color of the vertex.

public static IGLVertex SetColor(this IGLVertex vertex, in Vector4 rgbaColor)

Parameters

vertex IGLVertex

Vertex which change the color.

rgbaColor Vector4

Color to apply encoded in vector4 (range 0..1) as (red, green, blue, alpha).
Alpha=1 (full opaque).
Alpha=0 (full transparent).

Returns

IGLVertex

SetColor<T>(IEnumerable<T>, in Color)

Set the color primitives vertexes.

public static IEnumerable<T> SetColor<T>(this IEnumerable<T> primitives, in Color color) where T : GLPrimitiveBase

Parameters

primitives IEnumerable<T>

Gl primitives.

color Color

Color to set on primitives vertexes.

Returns

IEnumerable<T>

Calling enumerable.

Type Parameters

T

SetColor<T>(IEnumerable<T>, in Vector4)

Set the color primitives vertexes.

public static IEnumerable<T> SetColor<T>(this IEnumerable<T> primitives, in Vector4 rgbaColor) where T : GLPrimitiveBase

Parameters

primitives IEnumerable<T>

Gl primitives.

rgbaColor Vector4

Color to set on primitives vertexes.

Returns

IEnumerable<T>

Calling enumerable.

Type Parameters

T

SetColor<T>(T, in Color)

Set color on primitives vertexes of this figure.

public static T SetColor<T>(this T fig, in Color color) where T : IGLFigure

Parameters

fig T

Figure on which operate.

color Color

Color to set on vertexes.

Returns

T

This figure.

Type Parameters

T

SetColor<T>(T, in Vector4)

Set color on primitives vertexes of this figure.

public static T SetColor<T>(this T fig, in Vector4 rgbaColor) where T : IGLFigure

Parameters

fig T

Figure on which operate.

rgbaColor Vector4

Color to set on vertexes.

Returns

T

This figure.

Type Parameters

T

SetOrder<T>(T, int)

Change the figure order.

public static T SetOrder<T>(this T fig, int order) where T : IGLFigure

Parameters

fig T

Figure on which operate.

order int

Order to set.

Returns

T

This figure.

Type Parameters

T
See Also

SetOrigin(in Matrix4x4, in Vector3)

Create a new world matrix copy of the given one but with origin set to given one.

public static Matrix4x4 SetOrigin(this in Matrix4x4 m, in Vector3 origin)

Parameters

m Matrix4x4

Input world matrix.

origin Vector3

New origin.

Returns

Matrix4x4

Origin repositioned world matrix.

SetScreenMode<T>(IEnumerable<T>, bool)

Sets ScreenCoordMode on given figures.

public static IEnumerable<T> SetScreenMode<T>(this IEnumerable<T> figures, bool screenCoordMode) where T : IGLFigure

Parameters

figures IEnumerable<T>
screenCoordMode bool

Returns

IEnumerable<T>

Type Parameters

T

SetScreenMode<T>(T, bool)

Sets ScreenCoordMode on given figure.

public static T SetScreenMode<T>(this T figure, bool screenCoordMode) where T : IGLFigure

Parameters

figure T
screenCoordMode bool

Returns

T

Type Parameters

T

ShortString(CameraViewType)

public static string ShortString(this CameraViewType cvt)

Parameters

cvt CameraViewType

Returns

string

ToColor(HSV)

Retrieve system drawing color from given ColorHelper HSV color.

public static Color ToColor(this HSV hsv)

Parameters

hsv HSV

Returns

Color

ToColor(RGB)

Retrieve system drawing color from given ColorHelper RGB color.

public static Color ToColor(this RGB rgb)

Parameters

rgb RGB

Returns

Color

ToColor(in Vector4)

Convert given vector4 (red, green, blue, alpha) color to Color.

public static Color ToColor(this in Vector4 rgbaColor)

Parameters

rgbaColor Vector4

Color encoded in vector4 (range 0..1) as (red, green, blue, alpha).
Alpha=1 (full opaque).
Alpha=0 (full transparent).

Returns

Color

ToDxfColor(Color)

Convert system drawing color to dxf color.

public static AciColor ToDxfColor(this Color color)

Parameters

color Color

Returns

AciColor

ToDxfLine(IGLLine)

Create dxf line from given gl line.

public static Line ToDxfLine(this IGLLine line)

Parameters

line IGLLine

Returns

Line

ToDxfPoint(IGLPoint)

Create dxf point from given gl point.

public static Point ToDxfPoint(this IGLPoint point)

Parameters

point IGLPoint

Returns

Point

ToDxfVector3(IGLVertex)

Convert given gl vertex to dxf vector3.

public static Vector3 ToDxfVector3(this IGLVertex vertex)

Parameters

vertex IGLVertex

Returns

Vector3

ToDxfVector3(in Vector3)

Convert given system numerics vector3 to dxf vector3

public static Vector3 ToDxfVector3(this in Vector3 v)

Parameters

v Vector3

Returns

Vector3

ToFigure(IEnumerable<GLPoint>)

Create point figure from given point set.

public static GLPointFigure ToFigure(this IEnumerable<GLPoint> points)

Parameters

points IEnumerable<GLPoint>

Returns

GLPointFigure

ToFigure(IEnumerable<GLTriangle>)

Create a gl figure from given gl triangles.

public static GLTriangleFigure ToFigure(this IEnumerable<GLTriangle> triangles)

Parameters

triangles IEnumerable<GLTriangle>

Returns

GLTriangleFigure

ToFigure(IEnumerable<Vector3>)

Create point figure from given point set.

public static GLPointFigure ToFigure(this IEnumerable<Vector3> points)

Parameters

points IEnumerable<Vector3>

Returns

GLPointFigure

ToFloat(double)

Convert given double to float ensuring not exceed the float range.

public static float ToFloat(this double d)

Parameters

d double

Double which convert to float.

Returns

float

Float of the given double.

ToGLLine(Line, in Color, in Color)

Create a gl line primitive from given line geometry applying given from, to colors.

public static GLLine ToGLLine(this Line line, in Color colorFrom, in Color colorTo)

Parameters

line Line

Line geometry.

colorFrom Color

Color to apply the from vertex.

colorTo Color

Color to apply the to vertex.

Returns

GLLine

GL line primitive.

ToGLLine(Line, in Color?)

Create a gl line primitive from given line geometry.

public static GLLine ToGLLine(this Line line, in Color? color)

Parameters

line Line

Line geometry.

color Color?

(Optional) from, to line vertexes color.

Returns

GLLine

GL line primitive.

ToHSV(Color)

Retrieve ColorHelper HSV color from given system drawing color.

public static HSV ToHSV(this Color color)

Parameters

color Color

Returns

HSV

ToLine(Line3D)

Convert given sci line to line.

public static Line ToLine(this Line3D line)

Parameters

line Line3D

Returns

Line

ToLine3D(Line)

Convert given line to sci line.

public static Line3D ToLine3D(this Line line)

Parameters

line Line

Returns

Line3D

ToRGB(HSV)

Retrieve ColorHelper RGB color from given ColorHelper HSV color.

public static RGB ToRGB(this HSV hsv)

Parameters

hsv HSV

Returns

RGB

ToRGB(Color)

Retrieve ColorHelper RGB color from given system drawing color.

public static RGB ToRGB(this Color color)

Parameters

color Color

Returns

RGB

ToString(in Vector3, int)

public static string ToString(this in Vector3 v, int digits = 3)

Parameters

v Vector3
digits int

Returns

string

ToString(in Vector3, float)

public static string ToString(this in Vector3 v, float tol)

Parameters

v Vector3
tol float

Returns

string

ToString(float, int)

public static string ToString(this float d, int significantDigits)

Parameters

d float
significantDigits int

Returns

string

ToTriangle3D(GLTriangle)

Create sci Triangle3D from given gl triangle.

public static Triangle3D ToTriangle3D(this GLTriangle tri)

Parameters

tri GLTriangle

Returns

Triangle3D

ToUCS(in Vector3, in Matrix4x4, bool)

Transformation given one from wcs toward the given destination coordinate system.

public static Vector3 ToUCS(this in Vector3 v, in Matrix4x4 cs, bool evalCSOrigin = true)

Parameters

v Vector3

Vector to transform.

cs Matrix4x4

Destination coordinate system.

evalCSOrigin bool

If true the origin of the coordinate system will be evaluated during transformation ( default: true ).

Returns

Vector3

ToVector2(in Size)

Convert given screen size (width, height) to a vector2 (x, y).

public static Vector2 ToVector2(this in Size size)

Parameters

size Size

Returns

Vector2

ToVector3(in Color)

Convert given Color to vector3 (red, green, blue) discarding alpha information.

public static Vector3 ToVector3(this in Color color)

Parameters

color Color

Color to convert.

Returns

Vector3

ToVector4(in Color, float?)

Convert given Color to vector4 (red, green, blue, alpha).

public static Vector4 ToVector4(this in Color color, float? alpha = null)

Parameters

color Color

Color to convert.

alpha float?

(optional) Alpha override.
Alpha=1 (full opaque).
Alpha=0 (full transparent).
If not specified given color alpha will taken.

Returns

Vector4

ToWCS(in Vector3, in Matrix4x4, bool)

Transformation given one from the coordinate system given toward the wcs.

public static Vector3 ToWCS(this in Vector3 v, in Matrix4x4 cs, bool evalCSOrigin = true)

Parameters

v Vector3

Vector to transform.

cs Matrix4x4

Source coordinate system.

evalCSOrigin bool

If true the origin of the coordinate system will be evaluated during transofmration ( default: true ).

Returns

Vector3

Transform(Line, in Matrix4x4)

Create a new line with from, to transformed by the given transformation matrix.

public static Line Transform(this Line line, in Matrix4x4 m)

Parameters

line Line

Line to transform.

m Matrix4x4

Transformation matrix.

Returns

Line

Transformed line.

Transform(in Vector3, in Matrix4x4)

Transform given one within given transformation matrix.

public static Vector3 Transform(this in Vector3 v, in Matrix4x4 transform)

Parameters

v Vector3

Vector to transform.

transform Matrix4x4

Transformation matrix.

Returns

Vector3

Transformed vector.

Vertexes(IGLFigure)

Vertexes belonging this figure [object].

public static IEnumerable<GLVertex> Vertexes(this IGLFigure figure)

Parameters

figure IGLFigure

Returns

IEnumerable<GLVertex>