FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
Loading...
Searching...
No Matches
Functions
fdl_geometry.cpp File Reference

Geometry operations on the 4-layer FDL dimension hierarchy. More...

#include "fdl_geometry.h"
#include "fdl_constants.h"
#include <algorithm>
#include <cmath>

Functions

fdl_geometry_t fdl::detail::geometry_fill_hierarchy_gaps (fdl_geometry_t geo, fdl_point_f64_t anchor_offset)
 Fill gaps in the geometry hierarchy by propagating populated dimensions upward.
 
fdl_geometry_t fdl::detail::geometry_normalize_and_scale (fdl_geometry_t geo, double source_squeeze, double scale_factor, double target_squeeze)
 Normalize and scale all 7 fields (4 dimensions + 3 anchors) of the geometry.
 
fdl_geometry_t fdl::detail::geometry_round (fdl_geometry_t geo, fdl_round_strategy_t strategy)
 Round all 7 fields of the geometry using the given strategy.
 
fdl_geometry_t fdl::detail::geometry_apply_offset (fdl_geometry_t geo, fdl_point_f64_t offset, fdl_point_f64_t *theo_eff, fdl_point_f64_t *theo_prot, fdl_point_f64_t *theo_fram)
 Apply offset to all anchors, clamping to canvas bounds.
 
fdl_geometry_t fdl::detail::geometry_crop (fdl_geometry_t geo, fdl_point_f64_t theo_eff, fdl_point_f64_t theo_prot, fdl_point_f64_t theo_fram)
 Crop all dimensions to visible portion within canvas.
 
int fdl::detail::geometry_get_dims_anchor_from_path (const fdl_geometry_t *geo, fdl_geometry_path_t path, fdl_dimensions_f64_t *out_dims, fdl_point_f64_t *out_anchor)
 Extract dimensions and anchor from geometry by path.
 

Detailed Description

Geometry operations on the 4-layer FDL dimension hierarchy.

The FDL hierarchy is: canvas >= effective >= protection >= framing. This module provides the transformations applied during template application:

Function Documentation

◆ geometry_fill_hierarchy_gaps()

fdl_geometry_t fdl::detail::geometry_fill_hierarchy_gaps ( fdl_geometry_t  geo,
fdl_point_f64_t  anchor_offset 
)

Fill gaps in the geometry hierarchy by propagating populated dimensions upward.

Protection is NEVER filled from framing (special case). Anchors are adjusted by subtracting anchor_offset, then clamped >= 0.

Parameters
geoInput geometry with possibly-zero layers.
anchor_offsetOffset to subtract from all anchors.
Returns
Geometry with gaps filled and anchors adjusted.

◆ geometry_normalize_and_scale()

fdl_geometry_t fdl::detail::geometry_normalize_and_scale ( fdl_geometry_t  geo,
double  source_squeeze,
double  scale_factor,
double  target_squeeze 
)

Normalize and scale all 7 fields (4 dimensions + 3 anchors) of the geometry.

Parameters
geoInput geometry.
source_squeezeSource anamorphic squeeze.
scale_factorUniform scale factor to apply.
target_squeezeTarget anamorphic squeeze.
Returns
Normalized and scaled geometry.

◆ geometry_round()

fdl_geometry_t fdl::detail::geometry_round ( fdl_geometry_t  geo,
fdl_round_strategy_t  strategy 
)

Round all 7 fields of the geometry using the given strategy.

Parameters
geoInput geometry.
strategyRounding strategy (even + mode).
Returns
Geometry with all fields rounded.

◆ geometry_apply_offset()

fdl_geometry_t fdl::detail::geometry_apply_offset ( fdl_geometry_t  geo,
fdl_point_f64_t  offset,
fdl_point_f64_t theo_eff,
fdl_point_f64_t theo_prot,
fdl_point_f64_t theo_fram 
)

Apply offset to all anchors, clamping to canvas bounds.

Returns clamped geometry; theoretical (unclamped) anchors written to output pointers. If any output pointer is null, returns the geometry unmodified.

Parameters
geoInput geometry.
offsetOffset to add to all anchors.
theo_eff[out] Theoretical effective anchor (may be negative). Must not be null.
theo_prot[out] Theoretical protection anchor. Must not be null.
theo_fram[out] Theoretical framing anchor. Must not be null.
Returns
Geometry with clamped anchors, or unmodified geo if any output pointer is null.

◆ geometry_crop()

fdl_geometry_t fdl::detail::geometry_crop ( fdl_geometry_t  geo,
fdl_point_f64_t  theo_eff,
fdl_point_f64_t  theo_prot,
fdl_point_f64_t  theo_fram 
)

Crop all dimensions to visible portion within canvas.

Enforces hierarchy: canvas >= effective >= protection >= framing.

Parameters
geoInput geometry (anchors must already be clamped).
theo_effTheoretical effective anchor (unclamped).
theo_protTheoretical protection anchor (unclamped).
theo_framTheoretical framing anchor (unclamped).
Returns
Geometry with dimensions cropped to visible area.

◆ geometry_get_dims_anchor_from_path()

int fdl::detail::geometry_get_dims_anchor_from_path ( const fdl_geometry_t geo,
fdl_geometry_path_t  path,
fdl_dimensions_f64_t out_dims,
fdl_point_f64_t out_anchor 
)

Extract dimensions and anchor from geometry by path.

Parameters
geoGeometry to query.
pathWhich layer to extract.
out_dims[out] Extracted dimensions.
out_anchor[out] Extracted anchor point.
Returns
0 on success, -1 on invalid path.