Link Search Menu Expand Document

Sample Nearest Spline

PCGEx | Sample : Nearest Spline

Sample informations from the nearest spline

The Sample Nearest Spline node retrieves and blends spatial data from the target splines within a defined range, enabling fine-tuned sampling methods and weighting for tasks such as spline-based proximity analysis, spatial alignment, and extracting relational data.


In
Points that will sample data from targets
Point Filters
Points filters used to determine which points will be processed. Filtered out points will be treated as failed sampling.
Targets
Target splines to read data from
Out
In with extra attributes and properties

Table of content


The Sample Nearest Splines finds nearest(s) target splines and extract relational spatial data from them.

details/sampling-nearest-spline/lead.png

Sampling


Property Description
Settings
Sample Inputs Choose which input splines are to be sampled based on whether they’re closed loop or not.
Sample Method Selects the sampling method. See Sampling Methods.
Range Min Minimum sampling range.
Range Max Maximum sampling range.
Use 0 to sample all targets.
Local Range Min If enabled, uses a per-point double attribute value as minimum sampling range.
Local Range Max If enabled, uses a per-point double attribute value as maximum sampling range.
Distance Settings TBD

Splines that are not within range are ignored. If no spline is found within the specified range, the sampling for that point will be marked as Usuccessful.


Weighting
Weight Method Selects the method used to compute the weight of each target.
See Weighting.
Weight Over Distance Curve used to sample the final weight of each target.

Sampling Methods


Method Description
All (Within Range) Samples all splines within the specified range.
Closest Target Sample the single closest target spline within the specified range.
Farthest Target Sample the single farthest target spline within the specified range.

Weighting


details/sampling-nearest-spline/weighting.png

There is two weighting method available. Full Range and Effective Range. Each method outputs a [0..1] value that will be used to sample the Weight Over Distance curve.
However, there is a critical nuance between the two:

  • Full Range is a simple normalization, each target distance is divided by the longest one. As such, it’s very unlikely the curve will get sampled close to x=0.
  • Effective Range remaps each target distance using the shortest & longest distance as min/max. As such, the shortest sampled distance will sample the curve at x=0, and the longest at x=1.

Note that the Effective Range method tends to spread/scale the input set of values – but allows one to leverage the full range of the curve no matter the min/max input values.
Hence, using Full Range with only high (or low) input value will only sample a very narrow portion of the curve.

Important note: when using the Within range sample method, some outputs will use the final weighted position/transforms for their calculations; although mathematically correct, this may yield unusuable/innacurate results.


Outputs

Outputs are values extracted from the neighbor(s), and written to attributes on the output points.

Output Description
Generic
Success
bool
TBD
Spatial Data
Transform
FTransform
TBD
Look At
FVector
TBD
└─ Align TBD
└─ Use Up from… TBD
└─ Up Vector TBD
Distance
double
TBD
Signed Distance
double
TBD
└─ Axis TBD
└─ Only if Closed TBD
Angle
double
TBD
└─ Axis TBD
└─ Range TBD
Time
double
TBD
Num Inside
int32
TBD
└─ Only if Closed TBD
Num Samples
int32
TBD
Closed Loop
bool
TBD

Based on the selected Sample method, the output values are a weighted average of all the sampled targets. See Weighting.


Tagging

Some high level tags may be applied to the data based on overal sampling.

Tag Description
Has Successes Tag If enabled, add the specified tag to the output data if at least a single spline has been sampled.
Has No Successes Tag If enabled, add the specified tag to the output data if no spline was found within range.

Note that fail/success tagging will be affected by points filter as well; since filtered out points are considered fails.


Advanced


Property Description
Process Filtered Out As Fails If enabled, mark filtered out points as “failed”. Otherwise, just skip the processing altogether.
Only uncheck this if you want to ensure existing attribute values are preserved.
Default is set to true, as it should be on a first-pass sampling.