HAIDOX
HAIDOX Help

Math Engine Reference: Plot

개요

Renderer-independent adaptive plot data and graph feature analysis C ABI.

The library writes only caller-owned samples, indexed segments and feature candidates. It owns no window, renderer, GPU resource, history or persistent expression state.

관련 public header

공개 API

Header 사용 시작

이 module의 public declaration을 사용하려면 installed SDK의 다음 header를 include한다.

#include <math_engine/math_engine_plot.h>

Type과 callback

math_engine_plot_kind_t

Cartesian, parametric, polar와 implicit plot evaluator 해석 방식이다.

typedef enum math_engine_plot_kind {
    MATH_ENGINE_PLOT_KIND_INVALID = 0, /**< 유효 evaluator 해석이 없는 zero/sentinel kind다. */
    MATH_ENGINE_PLOT_KIND_CARTESIAN = 1, /**< Callback first=t에서 out_first=y(t), 출력 x=t다. */
    MATH_ENGINE_PLOT_KIND_PARAMETRIC = 2, /**< Callback first=t에서 (out_first,out_second)=(x(t),y(t))다. */
    MATH_ENGINE_PLOT_KIND_POLAR = 3, /**< Callback first=theta에서 out_first=r, 출력은 r(cos,sin)이다. */
    MATH_ENGINE_PLOT_KIND_IMPLICIT = 4 /**< Callback (first,second)=(x,y)에서 out_first=F(x,y)다. */
} math_engine_plot_kind_t;
  • math_engine_plot_kind_t.MATH_ENGINE_PLOT_KIND_INVALID

    유효 evaluator 해석이 없는 zero/sentinel kind다.

    MATH_ENGINE_PLOT_KIND_INVALID = 0,
    
  • math_engine_plot_kind_t.MATH_ENGINE_PLOT_KIND_CARTESIAN

    Callback first=t에서 out_first=y(t), 출력 x=t다.

    MATH_ENGINE_PLOT_KIND_CARTESIAN = 1,
    
  • math_engine_plot_kind_t.MATH_ENGINE_PLOT_KIND_PARAMETRIC

    Callback first=t에서 (out_first,out_second)=(x(t),y(t))다.

    MATH_ENGINE_PLOT_KIND_PARAMETRIC = 2,
    
  • math_engine_plot_kind_t.MATH_ENGINE_PLOT_KIND_POLAR

    Callback first=theta에서 out_first=r, 출력은 r(cos,sin)이다.

    MATH_ENGINE_PLOT_KIND_POLAR = 3,
    
  • math_engine_plot_kind_t.MATH_ENGINE_PLOT_KIND_IMPLICIT

    Callback (first,second)=(x,y)에서 out_first=F(x,y)다.

    MATH_ENGINE_PLOT_KIND_IMPLICIT = 4,
    

math_engine_plot_feature_kind_t

Sample pair에서 검출한 renderer-neutral feature candidate 분류다.

typedef enum math_engine_plot_feature_kind {
    MATH_ENGINE_PLOT_FEATURE_INVALID = 0, /**< 검출된 feature가 없는 sentinel이다. */
    MATH_ENGINE_PLOT_FEATURE_ROOT = 1, /**< Cartesian y가 sample pair 사이에서 0을 교차한다. */
    MATH_ENGINE_PLOT_FEATURE_INTERSECTION = 2, /**< Primary/secondary Cartesian y 차이가 부호를 바꾼다. */
    MATH_ENGINE_PLOT_FEATURE_LOCAL_MINIMUM = 3, /**< 인접 segment 세 점의 가운데 y가 local minimum 후보다. */
    MATH_ENGINE_PLOT_FEATURE_LOCAL_MAXIMUM = 4, /**< 인접 segment 세 점의 가운데 y가 local maximum 후보다. */
    MATH_ENGINE_PLOT_FEATURE_CUSP_CANDIDATE = 5 /**< Chord/slope 변화가 비매끄러운 점을 나타내는 heuristic 후보다. */
} math_engine_plot_feature_kind_t;
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_INVALID

    검출된 feature가 없는 sentinel이다.

    MATH_ENGINE_PLOT_FEATURE_INVALID = 0,
    
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_ROOT

    Cartesian y가 sample pair 사이에서 0을 교차한다.

    MATH_ENGINE_PLOT_FEATURE_ROOT = 1,
    
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_INTERSECTION

    Primary/secondary Cartesian y 차이가 부호를 바꾼다.

    MATH_ENGINE_PLOT_FEATURE_INTERSECTION = 2,
    
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_LOCAL_MINIMUM

    인접 segment 세 점의 가운데 y가 local minimum 후보다.

    MATH_ENGINE_PLOT_FEATURE_LOCAL_MINIMUM = 3,
    
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_LOCAL_MAXIMUM

    인접 segment 세 점의 가운데 y가 local maximum 후보다.

    MATH_ENGINE_PLOT_FEATURE_LOCAL_MAXIMUM = 4,
    
  • math_engine_plot_feature_kind_t.MATH_ENGINE_PLOT_FEATURE_CUSP_CANDIDATE

    Chord/slope 변화가 비매끄러운 점을 나타내는 heuristic 후보다.

    MATH_ENGINE_PLOT_FEATURE_CUSP_CANDIDATE = 5,
    

math_engine_plot_quality_t

결과 segment와 전체 batch의 refinement/budget 품질 분류다.

typedef enum math_engine_plot_quality {
    MATH_ENGINE_PLOT_QUALITY_INVALID = 0, /**< 아직 품질이 결정되지 않은 zero/sentinel이다. */
    MATH_ENGINE_PLOT_QUALITY_COARSE = 1, /**< 초기 cell/interval에서 추가 subdivision 없이 생성됐다. */
    MATH_ENGINE_PLOT_QUALITY_REFINED = 2, /**< Screen error 때문에 한 번 이상 subdivision한 결과다. */
    MATH_ENGINE_PLOT_QUALITY_LIMITED = 3 /**< Depth/capacity/evaluation/discontinuity 제한으로 tolerance를 보장하지 못한다. */
} math_engine_plot_quality_t;
  • math_engine_plot_quality_t.MATH_ENGINE_PLOT_QUALITY_INVALID

    아직 품질이 결정되지 않은 zero/sentinel이다.

    MATH_ENGINE_PLOT_QUALITY_INVALID = 0,
    
  • math_engine_plot_quality_t.MATH_ENGINE_PLOT_QUALITY_COARSE

    초기 cell/interval에서 추가 subdivision 없이 생성됐다.

    MATH_ENGINE_PLOT_QUALITY_COARSE = 1,
    
  • math_engine_plot_quality_t.MATH_ENGINE_PLOT_QUALITY_REFINED

    Screen error 때문에 한 번 이상 subdivision한 결과다.

    MATH_ENGINE_PLOT_QUALITY_REFINED = 2,
    
  • math_engine_plot_quality_t.MATH_ENGINE_PLOT_QUALITY_LIMITED

    Depth/capacity/evaluation/discontinuity 제한으로 tolerance를 보장하지 못한다.

    MATH_ENGINE_PLOT_QUALITY_LIMITED = 3,
    

math_engine_plot_viewport_f64_t

Viewport와 parameter domain이다. 좌표 단위는 caller가 정하고 pixel 크기는 실제 renderer를 소유하지 않으면서 screen-space chord error를 계산하기 위한 metadata다.

typedef struct math_engine_plot_viewport_f64 {
    uint32_t struct_size; /**< ABI byte 크기이며 exact viewport =sizeof=여야 한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_VIEWPORT_F64_VERSION_1=이어야 한다. */
    double x_min; /**< Caller 좌표계/단위의 finite visible x 포함 하한이다. */
    double x_max; /**< 같은 좌표계의 finite visible x 포함 상한이며 =x_min<x_max=다. */
    double y_min; /**< Caller 좌표계/단위의 finite visible y 포함 하한이다. */
    double y_max; /**< 같은 좌표계의 finite visible y 포함 상한이며 =y_min<y_max=다. */
    double parameter_min; /**< Cartesian/parametric/polar t 범위의 finite 시작값; init은 =x_min=을 쓴다. */
    double parameter_max; /**< Parameter 범위의 finite 끝값이며 =parameter_min<parameter_max=다. */
    uint32_t pixel_width; /**< X model-unit를 screen error로 환산할 nonzero viewport pixel 폭이다. */
    uint32_t pixel_height; /**< Y model-unit를 screen error로 환산할 nonzero viewport pixel 높이다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하는 ABI 확장 word 두 개다. */
} math_engine_plot_viewport_f64_t;
  • math_engine_plot_viewport_f64_t.struct_size

    ABI byte 크기이며 exact viewport sizeof 여야 한다.

    uint32_t struct_size;
    
  • math_engine_plot_viewport_f64_t.struct_version

    MATH_ENGINE_PLOT_VIEWPORT_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_viewport_f64_t.x_min

    Caller 좌표계/단위의 finite visible x 포함 하한이다.

    double x_min;
    
  • math_engine_plot_viewport_f64_t.x_max

    같은 좌표계의 finite visible x 포함 상한이며 x_min<x_max 다.

    double x_max;
    
  • math_engine_plot_viewport_f64_t.y_min

    Caller 좌표계/단위의 finite visible y 포함 하한이다.

    double y_min;
    
  • math_engine_plot_viewport_f64_t.y_max

    같은 좌표계의 finite visible y 포함 상한이며 y_min<y_max 다.

    double y_max;
    
  • math_engine_plot_viewport_f64_t.parameter_min

    Cartesian/parametric/polar t 범위의 finite 시작값; init은 x_min 을 쓴다.

    double parameter_min;
    
  • math_engine_plot_viewport_f64_t.parameter_max

    Parameter 범위의 finite 끝값이며 parameter_min<parameter_max 다.

    double parameter_max;
    
  • math_engine_plot_viewport_f64_t.pixel_width

    X model-unit를 screen error로 환산할 nonzero viewport pixel 폭이다.

    uint32_t pixel_width;
    
  • math_engine_plot_viewport_f64_t.pixel_height

    Y model-unit를 screen error로 환산할 nonzero viewport pixel 높이다.

    uint32_t pixel_height;
    
  • math_engine_plot_viewport_f64_t.reserved

    Caller가 0으로 두어야 하는 ABI 확장 word 두 개다.

    uint64_t reserved[2];
    

math_engine_plot_options_f64_t

Context mode에서 도출한 sampling ceiling과 tolerance다. Caller는 count/depth/evaluation ceiling을 줄일 수 있지만 동일 mode의 canonical 값보다 늘릴 수 없다.

typedef struct math_engine_plot_options_f64 {
    uint32_t struct_size; /**< ABI byte 크기이며 exact options =sizeof=여야 한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_OPTIONS_F64_VERSION_1=이어야 한다. */
    uint32_t kind; /**< Callback 해석과 sampler를 고르는 =math_engine_plot_kind_t= 값이다. */
    uint32_t flags; /**< V1 option bit는 정의되지 않아 반드시 0이다. */
    uint32_t initial_intervals; /**< Non-implicit parameter range를 균등 분할할 nonzero seed 수다. */
    uint32_t maximum_depth; /**< Adaptive binary subdivision의 nonzero 포함 depth ceiling이다. */
    uint32_t implicit_cells_x; /**< Implicit viewport를 나눌 nonzero horizontal cell 수다. */
    uint32_t implicit_cells_y; /**< Implicit viewport를 나눌 nonzero vertical cell 수다. */
    uint32_t progressive_batch_segments; /**< 한 호출에서 처리할 leaf interval/cell의 nonzero 최대 수다. */
    uint32_t reserved32; /**< Caller는 0으로 두며 V1 validation이 nonzero를 거부한다. */
    uint64_t maximum_samples; /**< Workspace/sample cursor의 element ceiling이며 최소 2다. */
    uint64_t maximum_segments; /**< 생성 가능한 indexed segment element 수의 nonzero ceiling이다. */
    uint64_t maximum_features; /**< 생성 가능한 feature candidate element 수의 nonzero ceiling이다. */
    uint64_t maximum_evaluations; /**< Primary와 secondary callback 호출을 합친 nonzero ceiling이다. */
    double screen_tolerance_pixels; /**< Adaptive chord-error 목표의 finite positive pixel 값이다. */
    double discontinuity_factor; /**< Viewport y span에 곱해 jump를 의심하는 finite positive factor다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하는 ABI 확장 word 두 개다. */
} math_engine_plot_options_f64_t;
  • math_engine_plot_options_f64_t.struct_size

    ABI byte 크기이며 exact options sizeof 여야 한다.

    uint32_t struct_size;
    
  • math_engine_plot_options_f64_t.struct_version

    MATH_ENGINE_PLOT_OPTIONS_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_options_f64_t.kind

    Callback 해석과 sampler를 고르는 math_engine_plot_kind_t 값이다.

    uint32_t kind;
    
  • math_engine_plot_options_f64_t.flags

    V1 option bit는 정의되지 않아 반드시 0이다.

    uint32_t flags;
    
  • math_engine_plot_options_f64_t.initial_intervals

    Non-implicit parameter range를 균등 분할할 nonzero seed 수다.

    uint32_t initial_intervals;
    
  • math_engine_plot_options_f64_t.maximum_depth

    Adaptive binary subdivision의 nonzero 포함 depth ceiling이다.

    uint32_t maximum_depth;
    
  • math_engine_plot_options_f64_t.implicit_cells_x

    Implicit viewport를 나눌 nonzero horizontal cell 수다.

    uint32_t implicit_cells_x;
    
  • math_engine_plot_options_f64_t.implicit_cells_y

    Implicit viewport를 나눌 nonzero vertical cell 수다.

    uint32_t implicit_cells_y;
    
  • math_engine_plot_options_f64_t.progressive_batch_segments

    한 호출에서 처리할 leaf interval/cell의 nonzero 최대 수다.

    uint32_t progressive_batch_segments;
    
  • math_engine_plot_options_f64_t.reserved32

    Caller는 0으로 두며 V1 validation이 nonzero를 거부한다.

    uint32_t reserved32;
    
  • math_engine_plot_options_f64_t.maximum_samples

    Workspace/sample cursor의 element ceiling이며 최소 2다.

    uint64_t maximum_samples;
    
  • math_engine_plot_options_f64_t.maximum_segments

    생성 가능한 indexed segment element 수의 nonzero ceiling이다.

    uint64_t maximum_segments;
    
  • math_engine_plot_options_f64_t.maximum_features

    생성 가능한 feature candidate element 수의 nonzero ceiling이다.

    uint64_t maximum_features;
    
  • math_engine_plot_options_f64_t.maximum_evaluations

    Primary와 secondary callback 호출을 합친 nonzero ceiling이다.

    uint64_t maximum_evaluations;
    
  • math_engine_plot_options_f64_t.screen_tolerance_pixels

    Adaptive chord-error 목표의 finite positive pixel 값이다.

    double screen_tolerance_pixels;
    
  • math_engine_plot_options_f64_t.discontinuity_factor

    Viewport y span에 곱해 jump를 의심하는 finite positive factor다.

    double discontinuity_factor;
    
  • math_engine_plot_options_f64_t.reserved

    Caller가 0으로 두어야 하는 ABI 확장 word 두 개다.

    uint64_t reserved[2];
    

math_engine_plot_evaluate_f64_fn

Plot kind에 따른 좌표 또는 implicit scalar를 계산하는 direct callback이다.

  • 매개변수 first: Cartesian/parametric/polar에서는 parameter, implicit에서는 x 좌표다.
  • 매개변수 second: Implicit에서는 y 좌표이고 다른 kind에서는 0인 보조 입력이다.
  • 매개변수 user_data: caller가 sampling 호출 동안 유효하게 유지하는 opaque pointer다.
  • 매개변수 out_first: Cartesian y, parametric x, polar radius 또는 implicit F(x,y) 를 기록한다.
  • 매개변수 out_second: Parametric y를 기록하며 다른 kind에서는 무시되는 storage다.
  • 반환: 성공 시 MATH_ENGINE_STATUS_OK, 평가 상태에 해당하는 음수 상태 code다.

Sampler가 좌표 하나를 필요로 할 때 primary를 정확히 한 번 호출하고, 유효한 Cartesian primary 뒤 intersection source가 있으면 secondary를 정확히 한 번 더 호출한다. 모든 호출은 math_engine_plot_sample_f64 을 실행한 같은 thread에서 동기 수행되며 callback/user_data와 output pointer는 return 뒤 보관되지 않는다. Callback은 재진입과 user_data 동기화를 소유하고 C++ exception 또는 다른 unwind를 C ABI 밖으로 전달하면 안 된다. 성공 시 kind가 사용하는 output은 모두 finite여야 한다. NON_FINITE, DOMAIN_ERROR, POLE, DIVIDE_BY_ZERO 와 OUT_OF_RANGE 는 missing/discontinuity sample로 처리되며 그 밖의 오류는 batch를 중단한다.

  • Math Engine ownership: user_data=borrowed out_first=caller out_second=caller
  • Math Engine nullable: user_data=true out_first=false out_second=false
  • Math Engine thread_safety: conditional
  • Math Engine callback: invocation=synchronous thread=caller retention=none exception=forbidden
typedef math_engine_status_t (*math_engine_plot_evaluate_f64_fn)(
    double first,
    double second,
    void* user_data,
    double* out_first,
    double* out_second);

math_engine_plot_source_f64_t

Direct evaluator binding이다. Primary와 nonzero fingerprint는 필수다. Secondary는 Cartesian intersection에만 사용하며 callback과 fingerprint를 함께 설정하거나 모두 비워야 한다. Callback과 user data는 sampling이 끝날 때까지 borrowed다.

typedef struct math_engine_plot_source_f64 {
    uint32_t struct_size; /**< Caller가 exact source record byte 크기로 설정한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_SOURCE_F64_VERSION_1=이어야 한다. */
    math_engine_plot_evaluate_f64_fn primary; /**< 필수 non-NULL borrowed callback; 전체 progressive sampling 수명 동안 유효하고 보관되지 않는다. */
    void* primary_user_data; /**< Nullable caller-owned state; 각 primary 호출 동안만 borrowed되고 engine은 해제·복사하지 않는다. */
    math_engine_plot_evaluate_f64_fn secondary; /**< Nullable Cartesian intersection callback; fingerprint가 0이 아닐 때만 설정하며 cursor 완료까지 유효하다. */
    void* secondary_user_data; /**< Nullable caller-owned secondary state; callback 호출 동안 borrowed되고 callback이 없으면 무시한다. */
    uint64_t source_fingerprint; /**< Primary 함수/데이터 의미를 caller가 안정적으로 식별하는 필수 nonzero 값이다. */
    uint64_t secondary_source_fingerprint; /**< Secondary가 있으면 필수 nonzero stable ID, 없으면 반드시 0이다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하는 ABI 확장 word 두 개다. */
} math_engine_plot_source_f64_t;
  • math_engine_plot_source_f64_t.struct_size

    Caller가 exact source record byte 크기로 설정한다.

    uint32_t struct_size;
    
  • math_engine_plot_source_f64_t.struct_version

    MATH_ENGINE_PLOT_SOURCE_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_source_f64_t.primary

    필수 non-NULL borrowed callback; 전체 progressive sampling 수명 동안 유효하고 보관되지 않는다.

    math_engine_plot_evaluate_f64_fn primary;
    
  • math_engine_plot_source_f64_t.primary_user_data

    Nullable caller-owned state; 각 primary 호출 동안만 borrowed되고 engine은 해제·복사하지 않는다.

    void* primary_user_data;
    
  • math_engine_plot_source_f64_t.secondary

    Nullable Cartesian intersection callback; fingerprint가 0이 아닐 때만 설정하며 cursor 완료까지 유효하다.

    math_engine_plot_evaluate_f64_fn secondary;
    
  • math_engine_plot_source_f64_t.secondary_user_data

    Nullable caller-owned secondary state; callback 호출 동안 borrowed되고 callback이 없으면 무시한다.

    void* secondary_user_data;
    
  • math_engine_plot_source_f64_t.source_fingerprint

    Primary 함수/데이터 의미를 caller가 안정적으로 식별하는 필수 nonzero 값이다.

    uint64_t source_fingerprint;
    
  • math_engine_plot_source_f64_t.secondary_source_fingerprint

    Secondary가 있으면 필수 nonzero stable ID, 없으면 반드시 0이다.

    uint64_t secondary_source_fingerprint;
    
  • math_engine_plot_source_f64_t.reserved

    Caller가 0으로 두어야 하는 ABI 확장 word 두 개다.

    uint64_t reserved[2];
    

math_engine_plot_sample_f64_t

한 parameter 평가의 renderer-neutral 좌표와 screen error다. Missing sample은 segment로 연결하지 않으며 fingerprint는 좌표·flag·depth·error bit pattern을 반영한다.

typedef struct math_engine_plot_sample_f64 {
    uint32_t struct_size; /**< Library가 exact sample record byte 크기를 기록한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_SAMPLE_F64_VERSION_1=로 기록된다. */
    uint32_t flags; /**< FINITE/MISSING/discontinuity/implicit bit의 유효한 OR다. */
    uint32_t refinement_depth; /**< 이 점을 만든 adaptive interval의 zero-based subdivision depth다. */
    double parameter; /**< Curve kind의 t/theta 또는 implicit contour 보간 parameter metadata다. */
    double x; /**< Viewport와 같은 caller-selected x 좌표 단위의 값이다. */
    double y; /**< Viewport와 같은 caller-selected y 좌표 단위의 값이다. */
    double secondary_y; /**< Cartesian secondary source y; 없거나 invalid이면 0이다. */
    double screen_error_pixels; /**< 이 sample 생성 interval의 finite nonnegative chord-error 진단값이다. */
    uint64_t sample_fingerprint; /**< Flags/depth와 모든 scalar bit pattern의 결정적 hash다. */
    uint64_t reserved[2]; /**< Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다. */
} math_engine_plot_sample_f64_t;
  • math_engine_plot_sample_f64_t.struct_size

    Library가 exact sample record byte 크기를 기록한다.

    uint32_t struct_size;
    
  • math_engine_plot_sample_f64_t.struct_version

    MATH_ENGINE_PLOT_SAMPLE_F64_VERSION_1 로 기록된다.

    uint32_t struct_version;
    
  • math_engine_plot_sample_f64_t.flags

    FINITE/MISSING/discontinuity/implicit bit의 유효한 OR다.

    uint32_t flags;
    
  • math_engine_plot_sample_f64_t.refinement_depth

    이 점을 만든 adaptive interval의 zero-based subdivision depth다.

    uint32_t refinement_depth;
    
  • math_engine_plot_sample_f64_t.parameter

    Curve kind의 t/theta 또는 implicit contour 보간 parameter metadata다.

    double parameter;
    
  • math_engine_plot_sample_f64_t.x

    Viewport와 같은 caller-selected x 좌표 단위의 값이다.

    double x;
    
  • math_engine_plot_sample_f64_t.y

    Viewport와 같은 caller-selected y 좌표 단위의 값이다.

    double y;
    
  • math_engine_plot_sample_f64_t.secondary_y

    Cartesian secondary source y; 없거나 invalid이면 0이다.

    double secondary_y;
    
  • math_engine_plot_sample_f64_t.screen_error_pixels

    이 sample 생성 interval의 finite nonnegative chord-error 진단값이다.

    double screen_error_pixels;
    
  • math_engine_plot_sample_f64_t.sample_fingerprint

    Flags/depth와 모든 scalar bit pattern의 결정적 hash다.

    uint64_t sample_fingerprint;
    
  • math_engine_plot_sample_f64_t.reserved

    Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다.

    uint64_t reserved[2];
    

math_engine_plot_segment_t

Sample 배열의 두 index를 연결하는 segment다. screen_error_pixels 는 viewport pixel metadata에서 계산한 chord-error 진단값이며 실제 renderer resource를 참조하지 않는다.

typedef struct math_engine_plot_segment {
    uint32_t struct_size; /**< Library가 exact segment record byte 크기를 기록한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_SEGMENT_VERSION_1=로 기록된다. */
    uint32_t first_sample; /**< =workspace.samples[0..cursor.sample_count)=의 첫 endpoint index다. */
    uint32_t second_sample; /**< 같은 sample prefix의 둘째 endpoint index이며 첫 index와 다르다. */
    uint32_t flags; /**< REFINED/IMPLICIT segment bit의 OR다. */
    uint32_t quality; /**< 이 segment의 coarse/refined/limited 품질 enum 값이다. */
    double screen_error_pixels; /**< Endpoint chord의 finite nonnegative screen-space error 추정값이다. */
    uint64_t segment_fingerprint; /**< Endpoint index, flags, quality와 error bit pattern의 hash다. */
    uint64_t reserved[2]; /**< Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다. */
} math_engine_plot_segment_t;
  • math_engine_plot_segment_t.struct_size

    Library가 exact segment record byte 크기를 기록한다.

    uint32_t struct_size;
    
  • math_engine_plot_segment_t.struct_version

    MATH_ENGINE_PLOT_SEGMENT_VERSION_1 로 기록된다.

    uint32_t struct_version;
    
  • math_engine_plot_segment_t.first_sample

    workspace.samples[0..cursor.sample_count) 의 첫 endpoint index다.

    uint32_t first_sample;
    
  • math_engine_plot_segment_t.second_sample

    같은 sample prefix의 둘째 endpoint index이며 첫 index와 다르다.

    uint32_t second_sample;
    
  • math_engine_plot_segment_t.flags

    REFINED/IMPLICIT segment bit의 OR다.

    uint32_t flags;
    
  • math_engine_plot_segment_t.quality

    이 segment의 coarse/refined/limited 품질 enum 값이다.

    uint32_t quality;
    
  • math_engine_plot_segment_t.screen_error_pixels

    Endpoint chord의 finite nonnegative screen-space error 추정값이다.

    double screen_error_pixels;
    
  • math_engine_plot_segment_t.segment_fingerprint

    Endpoint index, flags, quality와 error bit pattern의 hash다.

    uint64_t segment_fingerprint;
    
  • math_engine_plot_segment_t.reserved

    Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다.

    uint64_t reserved[2];
    

math_engine_plot_feature_f64_t

Root, intersection, local extremum 또는 cusp candidate다. error_bound 는 parameter/좌표 refinement에서 얻은 heuristic bound이며 엄밀한 수학적 root 인증값은 아니다.

typedef struct math_engine_plot_feature_f64 {
    uint32_t struct_size; /**< Library가 exact feature record byte 크기를 기록한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_FEATURE_F64_VERSION_1=로 기록된다. */
    uint32_t kind; /**< Root/intersection/extremum/cusp 후보 enum 값이다. */
    uint32_t flags; /**< V1 feature-specific bit는 없어 0으로 기록된다. */
    uint32_t first_sample; /**< 후보를 bracket하는 sample prefix의 첫 zero-based index다. */
    uint32_t second_sample; /**< 후보를 bracket하는 둘째 sample index다. */
    double parameter; /**< Bracket 보간 또는 가운데 sample의 t/theta 값이다. */
    double x; /**< Viewport와 같은 caller-selected frame/unit의 feature x 좌표다. */
    double y; /**< Viewport와 같은 caller-selected frame/unit의 feature y 좌표다. */
    double error_bound; /**< Parameter/좌표 보간에서 얻은 finite heuristic bound; 인증 오차가 아니다. */
    uint64_t feature_fingerprint; /**< Kind, sample indices와 scalar bit pattern의 결정적 hash다. */
    uint64_t reserved[2]; /**< Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다. */
} math_engine_plot_feature_f64_t;
  • math_engine_plot_feature_f64_t.struct_size

    Library가 exact feature record byte 크기를 기록한다.

    uint32_t struct_size;
    
  • math_engine_plot_feature_f64_t.struct_version

    MATH_ENGINE_PLOT_FEATURE_F64_VERSION_1 로 기록된다.

    uint32_t struct_version;
    
  • math_engine_plot_feature_f64_t.kind

    Root/intersection/extremum/cusp 후보 enum 값이다.

    uint32_t kind;
    
  • math_engine_plot_feature_f64_t.flags

    V1 feature-specific bit는 없어 0으로 기록된다.

    uint32_t flags;
    
  • math_engine_plot_feature_f64_t.first_sample

    후보를 bracket하는 sample prefix의 첫 zero-based index다.

    uint32_t first_sample;
    
  • math_engine_plot_feature_f64_t.second_sample

    후보를 bracket하는 둘째 sample index다.

    uint32_t second_sample;
    
  • math_engine_plot_feature_f64_t.parameter

    Bracket 보간 또는 가운데 sample의 t/theta 값이다.

    double parameter;
    
  • math_engine_plot_feature_f64_t.x

    Viewport와 같은 caller-selected frame/unit의 feature x 좌표다.

    double x;
    
  • math_engine_plot_feature_f64_t.y

    Viewport와 같은 caller-selected frame/unit의 feature y 좌표다.

    double y;
    
  • math_engine_plot_feature_f64_t.error_bound

    Parameter/좌표 보간에서 얻은 finite heuristic bound; 인증 오차가 아니다.

    double error_bound;
    
  • math_engine_plot_feature_f64_t.feature_fingerprint

    Kind, sample indices와 scalar bit pattern의 결정적 hash다.

    uint64_t feature_fingerprint;
    
  • math_engine_plot_feature_f64_t.reserved

    Library가 0으로 기록하고 renderer가 무시하는 ABI 확장 word다.

    uint64_t reserved[2];
    

math_engine_plot_interval_f64_t

Progressive 호출을 재개할 수 있도록 caller memory에 저장하는 adaptive interval이다.

typedef struct math_engine_plot_interval_f64 {
    uint32_t struct_size; /**< Library가 exact interval record byte 크기를 기록한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_INTERVAL_F64_VERSION_1=로 기록된다. */
    uint32_t depth; /**< Seed=0에서 시작하는 adaptive binary subdivision depth다. */
    uint32_t flags; /**< V1 interval-specific bit는 없어 0으로 기록된다. */
    double first_parameter; /**< Interval의 finite 첫 t/theta endpoint다. */
    double second_parameter; /**< Finite 둘째 endpoint이며 첫 endpoint보다 크다. */
    double first_x; /**< 첫 endpoint 평가의 caller-frame x 좌표다. */
    double first_y; /**< 첫 endpoint 평가의 caller-frame y 좌표다. */
    double first_secondary_y; /**< 첫 endpoint secondary Cartesian y, source가 없으면 0이다. */
    double second_x; /**< 둘째 endpoint 평가의 caller-frame x 좌표다. */
    double second_y; /**< 둘째 endpoint 평가의 caller-frame y 좌표다. */
    double second_secondary_y; /**< 둘째 endpoint secondary Cartesian y, source가 없으면 0이다. */
    uint64_t reserved[2]; /**< Library가 0으로 기록하고 caller가 무시하는 ABI 확장 word다. */
} math_engine_plot_interval_f64_t;
  • math_engine_plot_interval_f64_t.struct_size

    Library가 exact interval record byte 크기를 기록한다.

    uint32_t struct_size;
    
  • math_engine_plot_interval_f64_t.struct_version

    MATH_ENGINE_PLOT_INTERVAL_F64_VERSION_1 로 기록된다.

    uint32_t struct_version;
    
  • math_engine_plot_interval_f64_t.depth

    Seed=0에서 시작하는 adaptive binary subdivision depth다.

    uint32_t depth;
    
  • math_engine_plot_interval_f64_t.flags

    V1 interval-specific bit는 없어 0으로 기록된다.

    uint32_t flags;
    
  • math_engine_plot_interval_f64_t.first_parameter

    Interval의 finite 첫 t/theta endpoint다.

    double first_parameter;
    
  • math_engine_plot_interval_f64_t.second_parameter

    Finite 둘째 endpoint이며 첫 endpoint보다 크다.

    double second_parameter;
    
  • math_engine_plot_interval_f64_t.first_x

    첫 endpoint 평가의 caller-frame x 좌표다.

    double first_x;
    
  • math_engine_plot_interval_f64_t.first_y

    첫 endpoint 평가의 caller-frame y 좌표다.

    double first_y;
    
  • math_engine_plot_interval_f64_t.first_secondary_y

    첫 endpoint secondary Cartesian y, source가 없으면 0이다.

    double first_secondary_y;
    
  • math_engine_plot_interval_f64_t.second_x

    둘째 endpoint 평가의 caller-frame x 좌표다.

    double second_x;
    
  • math_engine_plot_interval_f64_t.second_y

    둘째 endpoint 평가의 caller-frame y 좌표다.

    double second_y;
    
  • math_engine_plot_interval_f64_t.second_secondary_y

    둘째 endpoint secondary Cartesian y, source가 없으면 0이다.

    double second_secondary_y;
    
  • math_engine_plot_interval_f64_t.reserved

    Library가 0으로 기록하고 caller가 무시하는 ABI 확장 word다.

    uint64_t reserved[2];
    

math_engine_plot_workspace_f64_t

Caller-owned interval/sample/segment/feature 배열과 각 원소 capacity다. 네 배열은 서로 겹치지 않고 cursor가 완료될 때까지 같은 주소에서 유효해야 한다.

typedef struct math_engine_plot_workspace_f64 {
    uint32_t struct_size; /**< Caller가 exact plot-workspace byte 크기로 설정한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_WORKSPACE_F64_VERSION_1=이어야 한다. */
    math_engine_plot_interval_f64_t* intervals; /**< Caller-owned mutable pending stack; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 같은 주소를 유지한다. */
    uint64_t interval_capacity; /**< =intervals= element 수이며 최소 =options.maximum_depth+2=다. */
    math_engine_plot_sample_f64_t* samples; /**< Caller-owned append-only sample 배열; NULL은 capacity 0일 때만 허용되고 유효 prefix는 =cursor.sample_count=다. */
    uint64_t sample_capacity; /**< =samples= element capacity이며 =options.maximum_samples= 이상이다. */
    math_engine_plot_segment_t* segments; /**< Caller-owned append-only indexed segment 배열; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 유지한다. */
    uint64_t segment_capacity; /**< =segments= element capacity이며 =options.maximum_segments= 이상이다. */
    math_engine_plot_feature_f64_t* features; /**< Caller-owned append-only feature 배열; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 유지한다. */
    uint64_t feature_capacity; /**< =features= element capacity이며 =options.maximum_features= 이상이다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하고 V1 validation이 검사하는 ABI word다. */
} math_engine_plot_workspace_f64_t;
  • math_engine_plot_workspace_f64_t.struct_size

    Caller가 exact plot-workspace byte 크기로 설정한다.

    uint32_t struct_size;
    
  • math_engine_plot_workspace_f64_t.struct_version

    MATH_ENGINE_PLOT_WORKSPACE_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_workspace_f64_t.intervals

    Caller-owned mutable pending stack; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 같은 주소를 유지한다.

    math_engine_plot_interval_f64_t* intervals;
    
  • math_engine_plot_workspace_f64_t.interval_capacity

    intervals element 수이며 최소 options.maximum_depth+2 다.

    uint64_t interval_capacity;
    
  • math_engine_plot_workspace_f64_t.samples

    Caller-owned append-only sample 배열; NULL은 capacity 0일 때만 허용되고 유효 prefix는 cursor.sample_count 다.

    math_engine_plot_sample_f64_t* samples;
    
  • math_engine_plot_workspace_f64_t.sample_capacity

    samples element capacity이며 options.maximum_samples 이상이다.

    uint64_t sample_capacity;
    
  • math_engine_plot_workspace_f64_t.segments

    Caller-owned append-only indexed segment 배열; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 유지한다.

    math_engine_plot_segment_t* segments;
    
  • math_engine_plot_workspace_f64_t.segment_capacity

    segments element capacity이며 options.maximum_segments 이상이다.

    uint64_t segment_capacity;
    
  • math_engine_plot_workspace_f64_t.features

    Caller-owned append-only feature 배열; NULL은 capacity 0일 때만 허용되고 cursor 완료까지 유지한다.

    math_engine_plot_feature_f64_t* features;
    
  • math_engine_plot_workspace_f64_t.feature_capacity

    features element capacity이며 options.maximum_features 이상이다.

    uint64_t feature_capacity;
    
  • math_engine_plot_workspace_f64_t.reserved

    Caller가 0으로 두어야 하고 V1 validation이 검사하는 ABI word다.

    uint64_t reserved[2];
    

math_engine_plot_cursor_t

Pointer-free progressive continuation record다. math_engine_plot_cursor_init 으로 초기화하고 input fingerprint가 같은 source/options/viewport에만 재사용한다.

typedef struct math_engine_plot_cursor {
    uint32_t struct_size; /**< ABI byte 크기이며 init이 exact cursor =sizeof=를 기록한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_CURSOR_VERSION_1=로 기록된다. */
    uint32_t initialized; /**< 첫 batch를 commit했으면 1, init 직후이면 0인 boolean이다. */
    uint32_t complete; /**< 모든 seed/cell 또는 terminal budget 종료 뒤 1인 boolean이다. */
    uint64_t next_seed; /**< 다음 non-implicit seed interval 또는 implicit row-major cell index다. */
    uint64_t pending_interval_count; /**< =workspace.intervals= stack의 현재 유효 prefix element 수다. */
    uint64_t sample_count; /**< =workspace.samples= append-only 유효 prefix와 누계 수다. */
    uint64_t segment_count; /**< =workspace.segments= append-only 유효 prefix와 누계 수다. */
    uint64_t feature_count; /**< =workspace.features= append-only 유효 prefix와 누계 수다. */
    uint64_t evaluation_count; /**< Primary와 secondary callback 호출을 합친 누계 수다. */
    uint64_t discontinuity_count; /**< 누계 missing/jump interval 또는 implicit cell 수다. */
    uint64_t input_fingerprint; /**< Mode, viewport, options와 source IDs를 묶어 resume identity를 검증한다. */
    uint64_t output_fingerprint; /**< Append 순서대로 sample/segment/feature hash를 누적한 FNV 계열 값이다. */
    uint64_t reserved[2]; /**< Caller가 0으로 유지해야 하는 ABI 확장 word 두 개다. */
} math_engine_plot_cursor_t;
  • math_engine_plot_cursor_t.struct_size

    ABI byte 크기이며 init이 exact cursor sizeof 를 기록한다.

    uint32_t struct_size;
    
  • math_engine_plot_cursor_t.struct_version

    MATH_ENGINE_PLOT_CURSOR_VERSION_1 로 기록된다.

    uint32_t struct_version;
    
  • math_engine_plot_cursor_t.initialized

    첫 batch를 commit했으면 1, init 직후이면 0인 boolean이다.

    uint32_t initialized;
    
  • math_engine_plot_cursor_t.complete

    모든 seed/cell 또는 terminal budget 종료 뒤 1인 boolean이다.

    uint32_t complete;
    
  • math_engine_plot_cursor_t.next_seed

    다음 non-implicit seed interval 또는 implicit row-major cell index다.

    uint64_t next_seed;
    
  • math_engine_plot_cursor_t.pending_interval_count

    workspace.intervals stack의 현재 유효 prefix element 수다.

    uint64_t pending_interval_count;
    
  • math_engine_plot_cursor_t.sample_count

    workspace.samples append-only 유효 prefix와 누계 수다.

    uint64_t sample_count;
    
  • math_engine_plot_cursor_t.segment_count

    workspace.segments append-only 유효 prefix와 누계 수다.

    uint64_t segment_count;
    
  • math_engine_plot_cursor_t.feature_count

    workspace.features append-only 유효 prefix와 누계 수다.

    uint64_t feature_count;
    
  • math_engine_plot_cursor_t.evaluation_count

    Primary와 secondary callback 호출을 합친 누계 수다.

    uint64_t evaluation_count;
    
  • math_engine_plot_cursor_t.discontinuity_count

    누계 missing/jump interval 또는 implicit cell 수다.

    uint64_t discontinuity_count;
    
  • math_engine_plot_cursor_t.input_fingerprint

    Mode, viewport, options와 source IDs를 묶어 resume identity를 검증한다.

    uint64_t input_fingerprint;
    
  • math_engine_plot_cursor_t.output_fingerprint

    Append 순서대로 sample/segment/feature hash를 누적한 FNV 계열 값이다.

    uint64_t output_fingerprint;
    
  • math_engine_plot_cursor_t.reserved

    Caller가 0으로 유지해야 하는 ABI 확장 word 두 개다.

    uint64_t reserved[2];
    

math_engine_plot_result_t

한 progressive batch의 추가량과 cursor 누계, quality, discontinuity와 deterministic fingerprint를 함께 commit하는 caller-owned POD다.

typedef struct math_engine_plot_result {
    uint32_t struct_size; /**< Caller가 exact batch-result byte 크기로 미리 설정한다. */
    uint32_t struct_version; /**< Caller가 =MATH_ENGINE_PLOT_RESULT_VERSION_1=로 설정한다. */
    uint32_t flags; /**< COMPLETE/PROGRESSIVE/budget/content/profile bit의 유효한 OR다. */
    uint32_t quality; /**< 누계 segment와 제한을 요약한 =math_engine_plot_quality_t= 값이다. */
    uint64_t samples_added; /**< 이번 성공 호출이 sample prefix에 append한 element 수다. */
    uint64_t segments_added; /**< 이번 성공 호출이 segment prefix에 append한 element 수다. */
    uint64_t features_added; /**< 이번 성공 호출이 feature prefix에 append한 element 수다. */
    uint64_t evaluations_added; /**< 이번 호출의 primary+secondary callback 실행 수다. */
    uint64_t total_samples; /**< Commit 뒤 =cursor.sample_count=와 같은 누계 sample 수다. */
    uint64_t total_segments; /**< Commit 뒤 =cursor.segment_count=와 같은 누계 segment 수다. */
    uint64_t total_features; /**< Commit 뒤 =cursor.feature_count=와 같은 누계 feature 수다. */
    uint64_t total_evaluations; /**< Commit 뒤 =cursor.evaluation_count=와 같은 누계 callback 수다. */
    uint64_t discontinuity_count; /**< Commit 뒤 cursor의 누계 discontinuity 수다. */
    double maximum_screen_error_pixels; /**< 이번 batch가 본 finite chord/cell error의 nonnegative 최대값이다. */
    uint64_t result_fingerprint; /**< Input/output fingerprints, flags, quality와 누계 counts의 hash다. */
    uint64_t reserved[2]; /**< Library가 0으로 commit하고 caller가 무시하는 ABI 확장 word다. */
} math_engine_plot_result_t;
  • math_engine_plot_result_t.struct_size

    Caller가 exact batch-result byte 크기로 미리 설정한다.

    uint32_t struct_size;
    
  • math_engine_plot_result_t.struct_version

    Caller가 MATH_ENGINE_PLOT_RESULT_VERSION_1 로 설정한다.

    uint32_t struct_version;
    
  • math_engine_plot_result_t.flags

    COMPLETE/PROGRESSIVE/budget/content/profile bit의 유효한 OR다.

    uint32_t flags;
    
  • math_engine_plot_result_t.quality

    누계 segment와 제한을 요약한 math_engine_plot_quality_t 값이다.

    uint32_t quality;
    
  • math_engine_plot_result_t.samples_added

    이번 성공 호출이 sample prefix에 append한 element 수다.

    uint64_t samples_added;
    
  • math_engine_plot_result_t.segments_added

    이번 성공 호출이 segment prefix에 append한 element 수다.

    uint64_t segments_added;
    
  • math_engine_plot_result_t.features_added

    이번 성공 호출이 feature prefix에 append한 element 수다.

    uint64_t features_added;
    
  • math_engine_plot_result_t.evaluations_added

    이번 호출의 primary+secondary callback 실행 수다.

    uint64_t evaluations_added;
    
  • math_engine_plot_result_t.total_samples

    Commit 뒤 cursor.sample_count 와 같은 누계 sample 수다.

    uint64_t total_samples;
    
  • math_engine_plot_result_t.total_segments

    Commit 뒤 cursor.segment_count 와 같은 누계 segment 수다.

    uint64_t total_segments;
    
  • math_engine_plot_result_t.total_features

    Commit 뒤 cursor.feature_count 와 같은 누계 feature 수다.

    uint64_t total_features;
    
  • math_engine_plot_result_t.total_evaluations

    Commit 뒤 cursor.evaluation_count 와 같은 누계 callback 수다.

    uint64_t total_evaluations;
    
  • math_engine_plot_result_t.discontinuity_count

    Commit 뒤 cursor의 누계 discontinuity 수다.

    uint64_t discontinuity_count;
    
  • math_engine_plot_result_t.maximum_screen_error_pixels

    이번 batch가 본 finite chord/cell error의 nonnegative 최대값이다.

    double maximum_screen_error_pixels;
    
  • math_engine_plot_result_t.result_fingerprint

    Input/output fingerprints, flags, quality와 누계 counts의 hash다.

    uint64_t result_fingerprint;
    
  • math_engine_plot_result_t.reserved

    Library가 0으로 commit하고 caller가 무시하는 ABI 확장 word다.

    uint64_t reserved[2];
    

math_engine_plot_expression_channel_f64_t

Exported plot evaluator adapter가 쓰는 compiled-program channel이다. Program/instruction/ constant/workspace는 borrowed이고 frame과 그 value slots는 caller-owned mutable state다. Assignment/stateful program은 허용하지 않지만 configured input slot은 매 평가마다 바뀐다.

typedef struct math_engine_plot_expression_channel_f64 {
    uint32_t struct_size; /**< Caller가 exact expression-channel byte 크기로 설정한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_EXPRESSION_CHANNEL_F64_VERSION_1=이어야 한다. */
    const math_engine_expression_program_t* program; /**< 필수 borrowed immutable header; source가 sampling에 쓰이는 전체 기간 유효하고 보관되지 않는다. */
    const math_engine_expression_instruction_t* instructions; /**< Borrowed immutable 배열; NULL 불가, =instruction_count=개가 유효하며 channel 호출 동안 유지한다. */
    uint64_t instruction_count; /**< =instructions= element 수이며 =program.instruction_count=와 정확히 같다. */
    const math_engine_expression_constant_t* constants; /**< Borrowed immutable 배열; NULL은 =constant_count==0=일 때만 허용되고 호출 동안 유효하다. */
    uint64_t constant_count; /**< =constants= element 수이며 =program.constant_count=와 정확히 같다. */
    math_engine_expression_eval_frame_t* frame; /**< 필수 caller-owned mutable frame; source 사용 기간 독점 유효하며 engine이 보관·해제하지 않는다. */
    const math_engine_expression_eval_workspace_t* workspace; /**< 필수 borrowed view가 가리키는 mutable arrays; 각 평가 동안 독점 사용되고 source 수명 동안 유지한다. */
    uint32_t first_value_slot; /**< =first= 입력을 쓸 =frame.values= index이며 value_count 미만이다. */
    uint32_t second_value_slot; /**< =second= 입력 slot index 또는 사용하지 않음을 뜻하는 =UINT32_MAX=다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하고 channel validation이 검사하는 ABI word다. */
} math_engine_plot_expression_channel_f64_t;
  • math_engine_plot_expression_channel_f64_t.struct_size

    Caller가 exact expression-channel byte 크기로 설정한다.

    uint32_t struct_size;
    
  • math_engine_plot_expression_channel_f64_t.struct_version

    MATH_ENGINE_PLOT_EXPRESSION_CHANNEL_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_expression_channel_f64_t.program

    필수 borrowed immutable header; source가 sampling에 쓰이는 전체 기간 유효하고 보관되지 않는다.

    const math_engine_expression_program_t* program;
    
  • math_engine_plot_expression_channel_f64_t.instructions

    Borrowed immutable 배열; NULL 불가, instruction_count 개가 유효하며 channel 호출 동안 유지한다.

    const math_engine_expression_instruction_t* instructions;
    
  • math_engine_plot_expression_channel_f64_t.instruction_count

    instructions element 수이며 program.instruction_count 와 정확히 같다.

    uint64_t instruction_count;
    
  • math_engine_plot_expression_channel_f64_t.constants

    Borrowed immutable 배열; NULL은 =constant_count==0=일 때만 허용되고 호출 동안 유효하다.

    const math_engine_expression_constant_t* constants;
    
  • math_engine_plot_expression_channel_f64_t.constant_count

    constants element 수이며 program.constant_count 와 정확히 같다.

    uint64_t constant_count;
    
  • math_engine_plot_expression_channel_f64_t.frame

    필수 caller-owned mutable frame; source 사용 기간 독점 유효하며 engine이 보관·해제하지 않는다.

    math_engine_expression_eval_frame_t* frame;
    
  • math_engine_plot_expression_channel_f64_t.workspace

    필수 borrowed view가 가리키는 mutable arrays; 각 평가 동안 독점 사용되고 source 수명 동안 유지한다.

    const math_engine_expression_eval_workspace_t* workspace;
    
  • math_engine_plot_expression_channel_f64_t.first_value_slot

    first 입력을 쓸 frame.values index이며 value_count 미만이다.

    uint32_t first_value_slot;
    
  • math_engine_plot_expression_channel_f64_t.second_value_slot

    second 입력 slot index 또는 사용하지 않음을 뜻하는 UINT32_MAX 다.

    uint32_t second_value_slot;
    
  • math_engine_plot_expression_channel_f64_t.reserved

    Caller가 0으로 두어야 하고 channel validation이 검사하는 ABI word다.

    uint64_t reserved[2];
    

math_engine_plot_expression_source_f64_t

하나 또는 두 expression channel과 평가 context의 binding이다. has_secondary 가 1이면 secondary channel도 완전해야 하며 두 mutable frame은 동시에 공유하지 않아야 한다.

typedef struct math_engine_plot_expression_source_f64 {
    uint32_t struct_size; /**< Caller가 exact expression-source byte 크기로 설정한다. */
    uint32_t struct_version; /**< =MATH_ENGINE_PLOT_EXPRESSION_SOURCE_F64_VERSION_1=이어야 한다. */
    const math_engine_context_t* context; /**< 필수 borrowed immutable evaluation context; 모든 channel 호출 동안 유효하고 보관되지 않는다. */
    math_engine_plot_expression_channel_f64_t primary; /**< Source가 값으로 소유하는 필수 primary channel binding이다. */
    math_engine_plot_expression_channel_f64_t secondary; /**< =has_secondary==1=일 때만 활성인 값 소유 secondary channel이다. */
    uint32_t has_secondary; /**< Secondary를 평가하면 1, 무시하면 0인 strict boolean이다. */
    uint32_t reserved32; /**< Caller는 0으로 두며 V1 validation이 nonzero를 거부한다. */
    uint64_t reserved[2]; /**< Caller가 0으로 두어야 하는 ABI 확장 word 두 개다. */
} math_engine_plot_expression_source_f64_t;
  • math_engine_plot_expression_source_f64_t.struct_size

    Caller가 exact expression-source byte 크기로 설정한다.

    uint32_t struct_size;
    
  • math_engine_plot_expression_source_f64_t.struct_version

    MATH_ENGINE_PLOT_EXPRESSION_SOURCE_F64_VERSION_1 이어야 한다.

    uint32_t struct_version;
    
  • math_engine_plot_expression_source_f64_t.context

    필수 borrowed immutable evaluation context; 모든 channel 호출 동안 유효하고 보관되지 않는다.

    const math_engine_context_t* context;
    
  • math_engine_plot_expression_source_f64_t.primary

    Source가 값으로 소유하는 필수 primary channel binding이다.

    math_engine_plot_expression_channel_f64_t primary;
    
  • math_engine_plot_expression_source_f64_t.secondary

    =has_secondary==1=일 때만 활성인 값 소유 secondary channel이다.

    math_engine_plot_expression_channel_f64_t secondary;
    
  • math_engine_plot_expression_source_f64_t.has_secondary

    Secondary를 평가하면 1, 무시하면 0인 strict boolean이다.

    uint32_t has_secondary;
    
  • math_engine_plot_expression_source_f64_t.reserved32

    Caller는 0으로 두며 V1 validation이 nonzero를 거부한다.

    uint32_t reserved32;
    
  • math_engine_plot_expression_source_f64_t.reserved

    Caller가 0으로 두어야 하는 ABI 확장 word 두 개다.

    uint64_t reserved[2];
    

Anonymous enum

anonymous_enum_at_line_84

Sample의 finite/missing/discontinuity/implicit-contour 상태 bit다.

enum {
    MATH_ENGINE_PLOT_SAMPLE_FINITE = UINT32_C(1) << 0u, /**< Bit 0: x/y와 해당 scalar가 finite 평가에서 왔다. */
    MATH_ENGINE_PLOT_SAMPLE_MISSING = UINT32_C(1) << 1u, /**< Bit 1: domain/pole/non-finite 상태라 연결할 좌표가 없다. */
    MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_LEFT = UINT32_C(1) << 2u, /**< Bit 2: sample 왼쪽 interval을 불연속으로 분류했다. */
    MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_RIGHT = UINT32_C(1) << 3u, /**< Bit 3: sample 오른쪽 interval을 불연속으로 분류했다. */
    MATH_ENGINE_PLOT_SAMPLE_IMPLICIT_CONTOUR = UINT32_C(1) << 4u /**< Bit 4: implicit cell edge의 F=0 보간점이다. */
};
  • MATH_ENGINE_PLOT_SAMPLE_FINITE

    Bit 0: x/y와 해당 scalar가 finite 평가에서 왔다.

    MATH_ENGINE_PLOT_SAMPLE_FINITE = UINT32_C(1) << 0u,
    
  • MATH_ENGINE_PLOT_SAMPLE_MISSING

    Bit 1: domain/pole/non-finite 상태라 연결할 좌표가 없다.

    MATH_ENGINE_PLOT_SAMPLE_MISSING = UINT32_C(1) << 1u,
    
  • MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_LEFT

    Bit 2: sample 왼쪽 interval을 불연속으로 분류했다.

    MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_LEFT = UINT32_C(1) << 2u,
    
  • MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_RIGHT

    Bit 3: sample 오른쪽 interval을 불연속으로 분류했다.

    MATH_ENGINE_PLOT_SAMPLE_DISCONTINUITY_RIGHT = UINT32_C(1) << 3u,
    
  • MATH_ENGINE_PLOT_SAMPLE_IMPLICIT_CONTOUR

    Bit 4: implicit cell edge의 F=0 보간점이다.

    MATH_ENGINE_PLOT_SAMPLE_IMPLICIT_CONTOUR = UINT32_C(1) << 4u,
    

anonymous_enum_at_line_93

Segment가 refinement 또는 implicit contour에서 생성됐음을 나타내는 bit다.

enum {
    MATH_ENGINE_PLOT_SEGMENT_REFINED = UINT32_C(1) << 0u, /**< Bit 0: adaptive depth가 0보다 큰 interval에서 생성됐다. */
    MATH_ENGINE_PLOT_SEGMENT_IMPLICIT = UINT32_C(1) << 1u /**< Bit 1: implicit marching-cell contour edge다. */
};
  • MATH_ENGINE_PLOT_SEGMENT_REFINED

    Bit 0: adaptive depth가 0보다 큰 interval에서 생성됐다.

    MATH_ENGINE_PLOT_SEGMENT_REFINED = UINT32_C(1) << 0u,
    
  • MATH_ENGINE_PLOT_SEGMENT_IMPLICIT

    Bit 1: implicit marching-cell contour edge다.

    MATH_ENGINE_PLOT_SEGMENT_IMPLICIT = UINT32_C(1) << 1u,
    

anonymous_enum_at_line_99

Progressive batch의 완료, 제한, 불연속과 feature 상태 bit다.

enum {
    MATH_ENGINE_PLOT_RESULT_COMPLETE = UINT32_C(1) << 0u, /**< Bit 0: cursor의 모든 seed/cell 처리가 terminal 완료됐다. */
    MATH_ENGINE_PLOT_RESULT_PROGRESSIVE = UINT32_C(1) << 1u, /**< Bit 1: 다음 batch에서 계속할 work가 남았다. */
    MATH_ENGINE_PLOT_RESULT_BUDGET_LIMITED = UINT32_C(1) << 2u, /**< Bit 2: evaluation/output/depth ceiling 때문에 조기 완료했다. */
    MATH_ENGINE_PLOT_RESULT_HAS_DISCONTINUITIES = UINT32_C(1) << 3u, /**< Bit 3: 누계 discontinuity count가 0보다 크다. */
    MATH_ENGINE_PLOT_RESULT_HAS_FEATURES = UINT32_C(1) << 4u, /**< Bit 4: 누계 feature count가 0보다 크다. */
    MATH_ENGINE_PLOT_RESULT_EMBEDDED_LIMITED = UINT32_C(1) << 5u /**< Bit 5: embedded profile의 축소된 canonical ceiling으로 실행했다. */
};
  • MATH_ENGINE_PLOT_RESULT_COMPLETE

    Bit 0: cursor의 모든 seed/cell 처리가 terminal 완료됐다.

    MATH_ENGINE_PLOT_RESULT_COMPLETE = UINT32_C(1) << 0u,
    
  • MATH_ENGINE_PLOT_RESULT_PROGRESSIVE

    Bit 1: 다음 batch에서 계속할 work가 남았다.

    MATH_ENGINE_PLOT_RESULT_PROGRESSIVE = UINT32_C(1) << 1u,
    
  • MATH_ENGINE_PLOT_RESULT_BUDGET_LIMITED

    Bit 2: evaluation/output/depth ceiling 때문에 조기 완료했다.

    MATH_ENGINE_PLOT_RESULT_BUDGET_LIMITED = UINT32_C(1) << 2u,
    
  • MATH_ENGINE_PLOT_RESULT_HAS_DISCONTINUITIES

    Bit 3: 누계 discontinuity count가 0보다 크다.

    MATH_ENGINE_PLOT_RESULT_HAS_DISCONTINUITIES = UINT32_C(1) << 3u,
    
  • MATH_ENGINE_PLOT_RESULT_HAS_FEATURES

    Bit 4: 누계 feature count가 0보다 크다.

    MATH_ENGINE_PLOT_RESULT_HAS_FEATURES = UINT32_C(1) << 4u,
    
  • MATH_ENGINE_PLOT_RESULT_EMBEDDED_LIMITED

    Bit 5: embedded profile의 축소된 canonical ceiling으로 실행했다.

    MATH_ENGINE_PLOT_RESULT_EMBEDDED_LIMITED = UINT32_C(1) << 5u,
    

Macro와 constant

MATH_ENGINE_PLOT_CURSOR_VERSION_1

Cursor V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_CURSOR_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_EXPRESSION_CHANNEL_F64_VERSION_1

Compiled-expression channel V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_EXPRESSION_CHANNEL_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_EXPRESSION_SOURCE_F64_VERSION_1

Compiled-expression source V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_EXPRESSION_SOURCE_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_FEATURE_F64_VERSION_1

Feature V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_FEATURE_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_INTERVAL_F64_VERSION_1

Progressive interval V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_INTERVAL_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_OPTIONS_F64_VERSION_1

Sampling options V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_OPTIONS_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_RESULT_VERSION_1

Batch result V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_RESULT_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_SAMPLE_F64_VERSION_1

Sample V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_SAMPLE_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_SEGMENT_VERSION_1

Segment V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_SEGMENT_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_SOURCE_F64_VERSION_1

Direct callback source V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_SOURCE_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_VIEWPORT_F64_VERSION_1

Viewport V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_VIEWPORT_F64_VERSION_1 UINT32_C(1)

MATH_ENGINE_PLOT_WORKSPACE_F64_VERSION_1

Workspace V1 struct_version 에 기록하는 unsigned ABI 값 1이다.

#define MATH_ENGINE_PLOT_WORKSPACE_F64_VERSION_1 UINT32_C(1)

Function

math_engine_plot_viewport_f64_init

Validated viewport를 만들고 x domain을 초기 parameter range로 복사한다.

  • 매개변수 x_min: finite x 좌표 최솟값이다.
  • 매개변수 x_max: finite x 좌표 최댓값이며 x_min 보다 커야 한다.
  • 매개변수 y_min: finite y 좌표 최솟값이다.
  • 매개변수 y_max: finite y 좌표 최댓값이며 y_min 보다 커야 한다.
  • 매개변수 pixel_width: screen-error 환산에 쓸 1 이상의 가로 pixel 수다.
  • 매개변수 pixel_height: screen-error 환산에 쓸 1 이상의 세로 pixel 수다.
  • 매개변수 out_viewport: 성공 시 versioned viewport를 받는 caller-owned storage다.
  • 반환: 성공 시 MATH_ENGINE_STATUS_OK, NULL/non-finite/역전 범위/0 pixel이면 MATH_ENGINE_STATUS_INVALID_ARGUMENT 다.

X/Y의 물리 단위는 caller가 정하되 evaluator와 일관돼야 한다. 성공 시에만 전체 POD를 commit하고 실패 시 output을 보존한다.

  • Math Engine ownership: out_viewport=caller
  • Math Engine nullable: out_viewport=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_plot_viewport_f64_init(
    double x_min,
    double x_max,
    double y_min,
    double y_max,
    uint32_t pixel_width,
    uint32_t pixel_height,
    math_engine_plot_viewport_f64_t* out_viewport);

math_engine_plot_options_f64_init

Validated context에서 plot kind별 deterministic Game/PC/FULL 기본값을 선택한다.

  • 매개변수 kind: Cartesian, parametric, polar 또는 implicit kind다.
  • 매개변수 context: mode와 최대 evaluation budget을 제공하는 borrowed context다.
  • 매개변수 out_options: 성공 시 mode ceiling 정책을 받는 caller-owned storage다.
  • 반환: 성공 시 MATH_ENGINE_STATUS_OK. Invalid kind/context는 해당 오류, Finance mode와 unsupported embedded mode는 MATH_ENGINE_STATUS_UNSUPPORTED 다.

최대 evaluation은 context budget 이하로 clamp한다. 동일 mode/context에는 같은 값을 반환하고 실패 시 output을 보존한다.

  • Math Engine ownership: context=borrowed out_options=caller
  • Math Engine nullable: context=false out_options=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_plot_options_f64_init(
    math_engine_plot_kind_t kind,
    const math_engine_context_t* context,
    math_engine_plot_options_f64_t* out_options);

math_engine_plot_cursor_init

비어 있는 pointer-free progressive cursor를 초기화한다.

  • 매개변수 out_cursor: 성공 시 초기 cursor를 받는 caller-owned storage다.
  • 반환: 성공 시 MATH_ENGINE_STATUS_OK, NULL이면 MATH_ENGINE_STATUS_INVALID_ARGUMENT 다.

Output fingerprint를 안정된 FNV seed로 설정하고 성공 시에만 전체 POD를 commit한다.

  • Math Engine ownership: out_cursor=caller
  • Math Engine nullable: out_cursor=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_plot_cursor_init(
    math_engine_plot_cursor_t* out_cursor);

math_engine_plot_sample_f64

하나 이상의 deterministic progressive plot batch를 평가한다.

  • 매개변수 viewport: 좌표/parameter 범위와 pixel metadata를 제공하는 borrowed viewport다.
  • 매개변수 source: sampling 동안 유효한 evaluator callback과 fingerprint binding이다.
  • 매개변수 options: kind, tolerance, batch 크기와 모든 capacity ceiling을 제공한다.
  • 매개변수 context: mode 검증과 pre-requested cancellation을 제공하는 borrowed context다.
  • 매개변수 workspace: 지속되는 caller-owned interval/sample/segment/feature 배열이다.
  • 매개변수 cursor: init된 caller-owned continuation이며 성공 batch마다 함께 갱신된다.
  • 매개변수 out_result: caller가 size/version을 미리 설정한 batch result storage다.
  • 반환: Batch가 처리되면 MATH_ENGINE_STATUS_OK. Validation, callback hard failure 또는 pre-requested cancellation에는 해당 음수 상태 code다.

Output 배열은 cursor가 완료될 때까지 append-only이고 기존 logical 원소는 보존된다. Missing/discontinuous region을 가로지르는 segment는 만들지 않는다. Domain/pole/non-finite evaluator 상태는 missing sample로 흡수하지만 다른 callback 오류는 batch를 중단한다. Evaluation/sample/segment/feature ceiling에 닿으면 오류 대신 BUDGET_LIMITED quality로 완료할 수 있다. screen_tolerance_pixels 는 viewport 축 범위를 pixel로 환산한 chord error refinement 기준이며 implicit contour error는 cell pixel diagonal이다.

같은 input fingerprint와 deterministic callback에는 append 순서와 fingerprints가 reproducible하다. Callback/cancel은 호출 thread에서 실행되고 저장되지 않는다. Workspace의 네 배열, cursor/result와 모든 input object는 서로 겹치지 않아야 한다. 실패 시 cursor, out_result와 logical counts는 보존되지만 아직 logical count 밖인 scratch array slot은 변경될 수 있다. 완료 cursor에 대한 추가 호출은 invalid다.

  • Math Engine ownership: viewport=borrowed source=borrowed options=borrowed context=borrowed
  • Math Engine ownership: workspace=caller cursor=caller out_result=caller
  • Math Engine nullable: viewport=false source=false options=false context=false
  • Math Engine nullable: workspace=false cursor=false out_result=false
  • Math Engine thread_safety: conditional
MATH_ENGINE_API math_engine_status_t math_engine_plot_sample_f64(
    const math_engine_plot_viewport_f64_t* viewport,
    const math_engine_plot_source_f64_t* source,
    const math_engine_plot_options_f64_t* options,
    const math_engine_context_t* context,
    math_engine_plot_workspace_f64_t* workspace,
    math_engine_plot_cursor_t* cursor,
    math_engine_plot_result_t* out_result);

math_engine_plot_expression_evaluate_f64

Compiled expression channel을 direct plot evaluator signature로 평가한다.

  • 매개변수 first: primary input slot에 기록할 finite 값이다.
  • 매개변수 second: configured second slot에 기록할 finite 값이다.
  • 매개변수 user_data: math_engine_plot_expression_source_f64_t binding이다.
  • 매개변수 out_first: 성공한 primary channel의 binary32/64 scalar 값을 받는다.
  • 매개변수 out_second: secondary가 있으면 그 scalar, 없으면 0을 받는다.
  • 반환: 성공 시 MATH_ENGINE_STATUS_OK. Binding/program/frame validation, unsupported numeric/stateful program, expression 평가 또는 non-finite 결과에는 해당 음수 code다.

각 channel의 configured input slot을 바꾼 뒤 immutable instruction/constant stream을 동기 평가한다. Assignment/stateful program과 non-binary scalar 결과는 지원하지 않는다. Program/instruction/constants/context는 borrowed이고 frame/workspace는 caller가 유지한다. Primary가 실패하면 두 output을 보존한다. Primary 성공 뒤 secondary가 실패하면 out_first 와 frame 변경은 rollback하지 않고 out_second 는 0으로 남으므로, 두 output의 atomic commit을 요구하는 caller는 임시 storage를 사용해야 한다. Binding/frame/output 범위는 서로 겹치지 않아야 하고 같은 mutable frame을 concurrent 호출에서 공유하면 안 된다.

  • Math Engine ownership: user_data=borrowed out_first=caller out_second=caller
  • Math Engine nullable: user_data=false out_first=false out_second=false
  • Math Engine thread_safety: separate_frame
MATH_ENGINE_API math_engine_status_t math_engine_plot_expression_evaluate_f64(
    double first,
    double second,
    void* user_data,
    double* out_first,
    double* out_second);