Table of Contents

Class Vec2i

Namespace
Hi.Geom
Assembly
HiGeom.dll

Basic 2D point (or vector).

public class Vec2i : IEquatable<Vec2i>
Inheritance
Vec2i
Implements
Inherited Members
Extension Methods

Constructors

Vec2i(Vec2i)

Copy ctor.

public Vec2i(Vec2i src)

Parameters

src Vec2i

src

Vec2i(BinaryReader)

Ctor by bytes: x = reader.ReadDouble(); y = reader.ReadDouble();

public Vec2i(BinaryReader reader)

Parameters

reader BinaryReader

reader

Vec2i(int, int)

Ctor.

public Vec2i(int x = 0, int y = 0)

Parameters

x int

x

y int

y

Vec2i(int, int, int)

Ctor by direction offset. Direction 0,1 indicate x,y respectively.

public Vec2i(int dir, int a, int b)

Parameters

dir int

direction offset

a int

value at direction (0+dir)%3

b int

value at direction (1+dir)%3

Vec2i(string)

Ctor by string. The format is (x,y).

public Vec2i(string src)

Parameters

src string

src

Fields

x

Value at x direction.

public int x

Field Value

int

y

Value at y direction.

public int y

Field Value

int

Properties

AbsSum

Sum of abs(x) and abs(y).

public int AbsSum { get; }

Property Value

int

LengthSquare

Length square.

public int LengthSquare { get; }

Property Value

int

Max

Get max value from {x,y}.

public int Max { get; }

Property Value

int

MaxAbsDir

Get the direction of the max absolute value.

public int MaxAbsDir { get; }

Property Value

int

MaxDir

Get the direction of the max value.

public int MaxDir { get; }

Property Value

int

Min

Get min value from {x,y}.

public int Min { get; }

Property Value

int

NativeByteSize

public static int NativeByteSize { get; }

Property Value

int

Byte size: sizeof(int) * 2.

One

Generate vec (1,1).

public static Vec2i One { get; }

Property Value

Vec2i

(1,1)

UnitX

Generate vec (1,0).

public static Vec2i UnitX { get; }

Property Value

Vec2i

(1,0)

UnitY

Generate vec (0,1).

public static Vec2i UnitY { get; }

Property Value

Vec2i

(0,1)

Zero

Generate vec (0,0).

public static Vec2i Zero { get; }

Property Value

Vec2i

(0,0)

Methods

At(int)

Member at direction.

public ref int At(int dir)

Parameters

dir int

direction

Returns

int

member

Cross(Vec2i)

Cross.

public int Cross(Vec2i src)

Parameters

src Vec2i

src

Returns

int

cross value

Dot(Vec2i)

Dot.

public int Dot(Vec2i src)

Parameters

src Vec2i

src

Returns

int

dotted value

Equals(Vec2i)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Vec2i other)

Parameters

other Vec2i

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GenOne()

Generate vec (1,1).

public static Vec2i GenOne()

Returns

Vec2i

(1,1)

GenUnitX()

Generate vec (1,0).

public static Vec2i GenUnitX()

Returns

Vec2i

(1,0)

GenUnitY()

Generate vec (0,1).

public static Vec2i GenUnitY()

Returns

Vec2i

(0,1)

GenZero()

Generate vec (0,0).

public static Vec2i GenZero()

Returns

Vec2i

(0,0)

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Output(BinaryWriter)

Output to bytes: writer.Write(x); writer.Write(y);

public void Output(BinaryWriter writer)

Parameters

writer BinaryWriter

writer

Set(Vec2i)

Set values by copy.

public Vec2i Set(Vec2i src)

Parameters

src Vec2i

src

Returns

Vec2i

this

Set(int, int)

Set values.

public Vec2i Set(int x, int y)

Parameters

x int

x

y int

y

Returns

Vec2i

this

Set(int, int, int)

Set values by direction offset. Direction 0,1,2 indicate x,y,z respectively.

public Vec2i Set(int dir, int a, int b)

Parameters

dir int

direction offset

a int

value at direction (0+dir)%3

b int

value at direction (1+dir)%3

Returns

Vec2i

this

Set(int[])

Set values by array.

public Vec2i Set(int[] xy)

Parameters

xy int[]

int[]{x,y}

Returns

Vec2i

this

SetEachValueAbs()

Set all member to absolute value.

public Vec2i SetEachValueAbs()

Returns

Vec2i

this

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(Vec2i, Vec2i)

Plus.

public static Vec2i operator +(Vec2i a, Vec2i b)

Parameters

a Vec2i

a

b Vec2i

b

Returns

Vec2i

a+b

operator /(Vec2i, int)

a/d.

public static Vec2i operator /(Vec2i a, int d)

Parameters

a Vec2i

a

d int

d

Returns

Vec2i

a/d

operator *(Vec2i, int)

a*s.

public static Vec2i operator *(Vec2i a, int s)

Parameters

a Vec2i

a

s int

s

Returns

Vec2i

a*s

operator -(Vec2i, Vec2i)

a-b.

public static Vec2i operator -(Vec2i a, Vec2i b)

Parameters

a Vec2i

a

b Vec2i

b

Returns

Vec2i

a-b

operator -(Vec2i)

Negate.

public static Vec2i operator -(Vec2i src)

Parameters

src Vec2i

src

Returns

Vec2i

Negate