Search Results for

    Show / Hide Table of Contents

    Class MortonCode

    Encodes points as the index along the planar Morton (Z-order) curve.

    The planar Morton (Z-order) curve is a continuous space-filling curve. The Morton curve defines an ordering of the points in the positive quadrant of the plane. The index of a point along the Morton curve is called the Morton code.

    A sequence of subsets of the Morton curve can be defined by a level number. Each level subset occupies a square range. The curve at level n Mₙ contains 2ⁿ⁺¹ points. It fills the range square of side 2ˡᵉᵛᵉˡ. Curve points have ordinates in the range [0, 2ˡᵉᵛᵉˡ - 1]. The code for a given point is identical at all levels. The level simply determines the number of points in the curve subset and the size of the range square.

    This implementation represents codes using 32-bit integers. This allows levels 0 to 16 to be handled. The class supports encoding points and decoding the point for a given code value.

    The Morton order has the property that it tends to preserve locality. This means that codes which are near in value will have spatially proximate points. The converse is not always true - the delta between codes for nearby points is not always small. But the average delta is small enough that the Morton order is an effective way of linearizing space to support range queries.

    Inheritance
    object
    MortonCode
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Shape.Fractal
    Assembly: NetTopologySuite.dll
    Syntax
    public static class MortonCode

    Fields

    | Edit this page View Source

    MaxLevel

    The maximum curve level that can be represented.

    Declaration
    public static readonly int MaxLevel
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Decode(int)

    Computes the point on the Morton curve for a given index.

    Declaration
    public static Coordinate Decode(int index)
    Parameters
    Type Name Description
    int index

    The index of the point on the curve.

    Returns
    Type Description
    Coordinate

    The point on the curve.

    | Edit this page View Source

    Encode(int, int)

    Computes the index of the point (x,y) in the Morton curve ordering.

    Declaration
    public static int Encode(int x, int y)
    Parameters
    Type Name Description
    int x

    The x ordinate of the point.

    int y

    The y ordinate of the point.

    Returns
    Type Description
    int

    The index of the point along the Morton curve.

    | Edit this page View Source

    Level(int)

    The level of the finite Morton curve which contains at least the given number of points.

    Declaration
    public static int Level(int numPoints)
    Parameters
    Type Name Description
    int numPoints

    The number of points required.

    Returns
    Type Description
    int

    The level of the curve.

    | Edit this page View Source

    MaxOrdinate(int)

    The maximum ordinate value for points in the curve for the given level. The maximum ordinate is 2ˡᵉᵛᵉˡ - 1.

    Declaration
    public static int MaxOrdinate(int level)
    Parameters
    Type Name Description
    int level

    The level of the curve.

    Returns
    Type Description
    int

    The maximum ordinate value.

    | Edit this page View Source

    Size(int)

    The number of points in the curve for the given level. The number of points is 2²ˡᵉᵛᵉˡ.

    Declaration
    public static int Size(int level)
    Parameters
    Type Name Description
    int level

    The level of the curve

    Returns
    Type Description
    int

    The number of points.

    See Also

    MortonCurveBuilder
    HilbertCode
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX