docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct EuclideanDistanceResult

    Result of a Euclidean distance comparison between two textures, including the average and maximum distance, as well as the per-pixel deltas and dimensions of the compared textures.

    Implements
    ITextureComparisonResult
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.TestTools.Graphics
    Assembly: UnityEngine.TestTools.Graphics.dll
    Syntax
    public struct EuclideanDistanceResult : ITextureComparisonResult

    Constructors

    EuclideanDistanceResult(double, double)

    Initializes a new instance of the EuclideanDistanceResult struct with the specified average and maximum distances, and empty deltas and dimensions. The deltas and dimensions can be set later if needed for further analysis or debugging.

    Declaration
    public EuclideanDistanceResult(double average, double max)
    Parameters
    Type Name Description
    double average

    The average Euclidean distance across all pixels.

    double max

    The maximum Euclidean distance found between any single pair of corresponding pixels.

    Properties

    Average

    The average Euclidean distance across all pixels between the expected and actual textures. A lower value indicates more similarity, with 0 meaning identical images.

    Declaration
    public readonly double Average { get; }
    Property Value
    Type Description
    double

    Deltas

    The per-pixel Euclidean distance deltas between the expected and actual textures.

    Declaration
    public float[] Deltas { readonly get; set; }
    Property Value
    Type Description
    float[]

    Height

    The height of the compared textures.

    Declaration
    public int Height { readonly get; set; }
    Property Value
    Type Description
    int

    Max

    The maximum Euclidean distance found between any single pair of corresponding pixels in the expected and actual textures. This value can help identify if there are specific areas of significant difference, even if the average distance is low.

    Declaration
    public readonly double Max { get; }
    Property Value
    Type Description
    double

    Width

    The width of the compared textures.

    Declaration
    public int Width { readonly get; set; }
    Property Value
    Type Description
    int

    Methods

    ClearTemporary()

    Clears the temporary data stored in the result, such as the per-pixel deltas and dimensions. This can be used to free up memory after the necessary information has been extracted from the result for reporting or analysis purposes. After calling this method, the Deltas array will be empty and the Width and Height will be reset to 0. Note that this does not affect the Average and Max properties, which will retain their values. Use this method when you no longer need the detailed per-pixel information and want to reduce memory usage. This is particularly useful in scenarios where the result is being stored or transmitted, and the detailed deltas and dimensions are not required for the final outcome of the test, but the average and maximum distances are still relevant for determining pass/fail status or for reporting purposes.

    Declaration
    public void ClearTemporary()

    Implements

    ITextureComparisonResult
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)