Table of Contents

Struct Point3D

Namespace
Moongate.UO.Data.Geometry
Assembly
Moongate.UO.Data.dll

Represents Point3D.

public struct Point3D : IPoint3D, IPoint2D, IComparable<Point3D>, IComparable<IPoint3D>, IEquatable<object>, IEquatable<Point3D>, IEquatable<IPoint3D>, ISpanFormattable, IFormattable, ISpanParsable<Point3D>, IParsable<Point3D>
Implements
Inherited Members

Constructors

Point3D(Point2D, int)

public Point3D(Point2D p, int z)

Parameters

p Point2D
z int

Point3D(Point3D)

public Point3D(Point3D p)

Parameters

p Point3D

Point3D(IPoint3D)

public Point3D(IPoint3D p)

Parameters

p IPoint3D

Point3D(int, int, int)

public Point3D(int x, int y, int z)

Parameters

x int
y int
z int

Fields

Zero

public static readonly Point3D Zero

Field Value

Point3D

Properties

X

Gets the X coordinate.

public int X { readonly get; set; }

Property Value

int

Y

Gets the Y coordinate.

public int Y { readonly get; set; }

Property Value

int

Z

Gets the Z coordinate.

public int Z { readonly get; set; }

Property Value

int

Methods

CompareTo(Point3D)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(Point3D other)

Parameters

other Point3D

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

CompareTo(IPoint3D)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(IPoint3D other)

Parameters

other IPoint3D

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Equals(Point3D)

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

public bool Equals(Point3D other)

Parameters

other Point3D

An object to compare with this object.

Returns

bool

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

Equals(IPoint3D)

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

public bool Equals(IPoint3D other)

Parameters

other IPoint3D

An object to compare with this object.

Returns

bool

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

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetBaseDirection(DirectionType)

Removes running flag from direction

public static DirectionType GetBaseDirection(DirectionType direction)

Parameters

direction DirectionType

Direction with or without running flag

Returns

DirectionType

Base direction without running flag

GetDirectionTo(Point3D)

Gets direction from current point to target point

public DirectionType GetDirectionTo(Point3D target)

Parameters

target Point3D

Target point

Returns

DirectionType

Direction to target

GetDistance(Point3D)

Gets the 2D distance to another point (ignoring Z coordinate)

public double GetDistance(Point3D target)

Parameters

target Point3D

Target point

Returns

double

Distance in tiles as double

GetDistance(IPoint3D)

Gets the 2D distance to another point (ignoring Z coordinate)

public double GetDistance(IPoint3D target)

Parameters

target IPoint3D

Target point

Returns

double

Distance in tiles as double

GetDistance3D(Point3D)

Gets the 3D distance to another point (including Z coordinate)

public double GetDistance3D(Point3D target)

Parameters

target Point3D

Target point

Returns

double

Distance in tiles as double

GetDistance3D(IPoint3D)

Gets the 3D distance to another point (including Z coordinate)

public double GetDistance3D(IPoint3D target)

Parameters

target IPoint3D

Target point

Returns

double

Distance in tiles as double

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

InRange(Point3D, int)

Checks if another point is within the specified range of this point Uses 2D distance calculation (ignoring Z coordinate) like UO does

public bool InRange(Point3D target, int range)

Parameters

target Point3D

Target point to check distance to

range int

Maximum range in tiles

Returns

bool

True if target is within range, false otherwise

InRange(IPoint3D, int)

Checks if another point is within the specified range of this point Uses 2D distance calculation (ignoring Z coordinate) like UO does

public bool InRange(IPoint3D target, int range)

Parameters

target IPoint3D

Target point to check distance to

range int

Maximum range in tiles

Returns

bool

True if target is within range, false otherwise

InRange3D(Point3D, int)

Checks if another point is within the specified range of this point Uses 3D distance calculation (including Z coordinate)

public bool InRange3D(Point3D target, int range)

Parameters

target Point3D

Target point to check distance to

range int

Maximum range in tiles

Returns

bool

True if target is within 3D range, false otherwise

InRange3D(IPoint3D, int)

Checks if another point is within the specified range of this point Uses 3D distance calculation (including Z coordinate)

public bool InRange3D(IPoint3D target, int range)

Parameters

target IPoint3D

Target point to check distance to

range int

Maximum range in tiles

Returns

bool

True if target is within 3D range, false otherwise

IsRunning(DirectionType)

Checks if a direction includes running flag

public static bool IsRunning(DirectionType direction)

Parameters

direction DirectionType

Direction to check

Returns

bool

True if running flag is set

Move(DirectionType)

Adds a direction offset to current position

public Point3D Move(DirectionType direction)

Parameters

direction DirectionType

Direction to move

Returns

Point3D

New Point3D with offset applied

Parse(ReadOnlySpan<char>, IFormatProvider)

Parses a span of characters into a value.

public static Point3D Parse(ReadOnlySpan<char> s, IFormatProvider provider)

Parameters

s ReadOnlySpan<char>

The span of characters to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

Returns

Point3D

The result of parsing s.

Exceptions

FormatException

s is not in the correct format.

OverflowException

s is not representable by Point3D.

Parse(string)

public static Point3D Parse(string s)

Parameters

s string

Returns

Point3D

Parse(string, IFormatProvider)

Parses a string into a value.

public static Point3D Parse(string s, IFormatProvider provider)

Parameters

s string

The string to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

Returns

Point3D

The result of parsing s.

Exceptions

ArgumentNullException

s is null.

FormatException

s is not in the correct format.

OverflowException

s is not representable by Point3D.

SetRunning(DirectionType)

Adds running flag to direction

public static DirectionType SetRunning(DirectionType direction)

Parameters

direction DirectionType

Base direction

Returns

DirectionType

Direction with running flag

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider)

Tries to format the value of the current instance into the provided span of characters.

public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)

Parameters

destination Span<char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten int

When this method returns, contains the number of characters that were written in destination.

format ReadOnlySpan<char>

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

provider IFormatProvider

An optional object that supplies culture-specific formatting information for destination.

Returns

bool

true if the formatting was successful; otherwise, false.

TryParse(ReadOnlySpan<char>, IFormatProvider, out Point3D)

Tries to parse a span of characters into a value.

public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider provider, out Point3D result)

Parameters

s ReadOnlySpan<char>

The span of characters to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

result Point3D

When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Returns

bool

true if s was successfully parsed; otherwise, false.

TryParse(string, IFormatProvider, out Point3D)

Tries to parse a string into a value.

public static bool TryParse(string s, IFormatProvider provider, out Point3D result)

Parameters

s string

The string to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

result Point3D

When this method returns, contains the result of successfully parsing s or an undefined value on failure.

Returns

bool

true if s was successfully parsed; otherwise, false.

Operators

operator +(Point3D, Point3D)

Addition operator for Point3D

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

Parameters

a Point3D
b Point3D

Returns

Point3D

operator +(Point3D, DirectionType)

Addition operator for Point3D + DirectionType Moves the point in the specified direction

public static Point3D operator +(Point3D point, DirectionType direction)

Parameters

point Point3D
direction DirectionType

Returns

Point3D

operator +(DirectionType, Point3D)

Addition operator for DirectionType + Point3D Moves the point in the specified direction (commutative)

public static Point3D operator +(DirectionType direction, Point3D point)

Parameters

direction DirectionType
point Point3D

Returns

Point3D

operator ==(Point3D, Point3D)

public static bool operator ==(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator ==(Point3D, IPoint3D)

public static bool operator ==(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

operator >(Point3D, Point3D)

public static bool operator >(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator >(Point3D, IPoint3D)

public static bool operator >(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

operator >=(Point3D, Point3D)

public static bool operator >=(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator >=(Point3D, IPoint3D)

public static bool operator >=(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

implicit operator DirectionType(Point3D)

Implicit conversion from Point3D to DirectionType Converts movement offset to direction (ignores Z coordinate)

public static implicit operator DirectionType(Point3D point)

Parameters

point Point3D

Point3D offset to convert

Returns

DirectionType

DirectionType representing the movement direction

implicit operator Point3D(DirectionType)

Implicit conversion from DirectionType to Point3D offset Converts direction to movement offset coordinates

public static implicit operator Point3D(DirectionType direction)

Parameters

direction DirectionType

Direction to convert

Returns

Point3D

Point3D with offset coordinates

operator !=(Point3D, Point3D)

public static bool operator !=(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator !=(Point3D, IPoint3D)

public static bool operator !=(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

operator <(Point3D, Point3D)

public static bool operator <(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator <(Point3D, IPoint3D)

public static bool operator <(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

operator <=(Point3D, Point3D)

public static bool operator <=(Point3D l, Point3D r)

Parameters

l Point3D
r Point3D

Returns

bool

operator <=(Point3D, IPoint3D)

public static bool operator <=(Point3D l, IPoint3D r)

Parameters

l Point3D
r IPoint3D

Returns

bool

operator -(Point3D, Point3D)

Subtraction operator for Point3D

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

Parameters

a Point3D
b Point3D

Returns

Point3D

operator -(Point3D, DirectionType)

Subtraction operator for Point3D - DirectionType Moves the point in the opposite direction

public static Point3D operator -(Point3D point, DirectionType direction)

Parameters

point Point3D
direction DirectionType

Returns

Point3D