class ThreeDViewer.Mathematics.Geometry.Face

Overview

Represents one face of a 3D model. More…

class Face
{
public:
    // fields

    static const int MinVertices = 3;

    // properties

    Vector3 Normal;
    Vector3 Center;
    bool IsClockwise;
    Vector4[] Vertices;
    Color Color;
    Vector4 this[int index];

    // methods

    Face(Vector4[] vertices);
    Face(Vector4[] vertices, Color color);
    Face(Vector4 vertex0, Vector4 vertex1, Vector4 vertex2, Color color);

    Face(
        Vector4 vertex0,
        Vector4 vertex1,
        Vector4 vertex2,
        Vector4 vertex3,
        Color color
        );

    Vector3[] ToPhysicalCoords();
    void LightUp(Vector3 lightDirection, Color lightColor);
    static Face operator * (Face f1, Matrix4 m2);
};

Detailed Documentation

Represents one face of a 3D model.

Fields

static const int MinVertices = 3

The minimum amounts of vertices a face should have.

Properties

Vector3 Normal

Gets the normal of the face.

Vector3 Center

Gets the center of the face.

bool IsClockwise

Gets a value indicating whether the vertices in this face are clockwise.

Vector4[] Vertices

Gets or sets the vertices that are presents in the face.

Color Color

Gets or sets the color of the face.

Vector4 this[int index]

Gets or sets the vertex at this index.

Parameters:

index

Index of the vertex.

Returns:

The vertex at the index.

Methods

Face(Vector4[] vertices)

Initializes a new instance of the Face class.

Parameters:

vertices

The vertices that the face should contain.

ArgumentException

Thrown when there are less than 3 points.

Face(Vector4[] vertices, Color color)

Initializes a new instance of the Face class.

Parameters:

vertices

The vertices that the face should contain.

color

The color of the face.

ArgumentException

Thrown when there are less than 3 points.

Face(Vector4 vertex0, Vector4 vertex1, Vector4 vertex2, Color color)

Initializes a new instance of the Face class.

Parameters:

vertex0

First point.

vertex1

Second point.

vertex2

Third point.

color

The color of the face.

Face(
    Vector4 vertex0,
    Vector4 vertex1,
    Vector4 vertex2,
    Vector4 vertex3,
    Color color
    )

Initializes a new instance of the Face class.

Parameters:

vertex0

First point.

vertex1

Second point.

vertex2

Third point.

vertex3

Fourth point.

color

The color of the face.

Vector3[] ToPhysicalCoords()

Converts the vertices of this face to physical coordinates.

Returns:

The vertices of this face as physical coordinates.

void LightUp(Vector3 lightDirection, Color lightColor)

Updates the color (lighting) of the face.

Parameters:

lightDirection

The direction vector of the light.

lightColor

The color the face will be at 100% lighting.

static Face operator * (Face f1, Matrix4 m2)

Multiplies the vertices of the face by the matrix.

Parameters:

f1

The face to multiply.

m2

The matrix to multiply the face by.

Returns:

The multiplied face.