Path design rarely happens on a truly “flat” site. Ignoring topography when routing a path inevitably leads to issues, particularly regarding accessibility and user comfort.
The commonly accepted maximum slope for accessible paths is 1:12, while 1:20 is generally considered more comfortable. Natural trails may exceed this, but prolonged steep segments reduce usability.
In this tutorial, we will develop a terrain-responsive path algorithm with slope control.
We will compare two Grasshopper approaches:
- Galapagos — an evolutionary solver for optimization.
- Anemone — a plugin enabling loop-based, step-by-step algorithmic control.
The goal is to evaluate which method performs better for slope-constrained path generation.


- Grasshopper result 2. Anemone result
1. Galapagos
The script generates a parametric path between start and end points, where internal control points act as variable genes. The curve is projected onto the terrain, and slope is calculated for each segment.
Average, minimum, and maximum slope values define the fitness function, which Galapagos optimizes by iteratively evolving the path geometry within the given constraints.
Script Overview
1.1 Curved Terrain Path
We define the start and end points, draw a line between them, and divide it into points. Using Cull Index, we remove the first and last points (fixed) and connect the remaining ones to a Gene Pool — the number of genes must match the number of movable points, with min/max values adjusted to the terrain scale. The start and end points are added back, a curve is created with Interpolate, and projected onto the terrain surface.


1.2 Average Slope
We create line segments between every two consecutive points to easily calculate the length of each segment. Based on segment length and elevation difference, we compute the slope percentage.


1.3 Min / Max Path Slope + Running Length
We determine the minimum and maximum slope values along the path to control acceptable limits. In addition, we calculate the total running length of the route to evaluate its overall efficiency.

1.4 Galapagos Optimization
We combine all parameters (slope values and path characteristics) and run Galapagos to find the most efficient and realistic route within the defined constraints.



- First random variant 2. Second random variant 3. Final result
2. Anemone
The script uses a recursive process to generate an acceptable path step by step. It incrementally adjusts direction based on slope conditions, following a logic similar to natural gradient-seeking behavior, but implemented in a controlled algorithmic way.

Script Overview
2.1 Input Parameters
We measure the surface dimensions and multiply them by a factor to define a proportional step size, allowing the script to adapt to different terrain scales. The start and destination geometry are then projected onto the surface using Project Point


2.2 Starting the Loop, Finding Possible Directions
The loop uses D0 as the active (current) path point and D1 as the archive of all previous points, with the start point inserted into both streams. At each iteration, the script calculates possible next directions based on the allowable rise/fall derived from the defined slope ratio and the step size.
Geometrically, a circle with a radius equal to the step size is created at the active point, then copied upward and downward by the allowable vertical difference. A Loft is generated between these circles, and a Brep | Brep Intersection (BBX) with the terrain surface produces curves representing all valid next positions that stay within the slope constraint.


2.3 Deciding on the “Best” Next Point, Finishing the Loop
The curves from Brep | Brep Intersect (BBX) represent all allowable next positions within the slope limit. To select the next point, the script finds the closest point on each curve using Curve Closest Point, then compares those candidates with the final destination using Closest Point, selecting the one nearest to the target.
The chosen point becomes the new Path End Point, added to D1 (the growing list of path points) and replacing the active point in D0. The loop continues until the distance between the current point and the destination is smaller than the defined step size, triggering a Boolean condition that stops the loop.
Finally, all points stored in D1 are connected with a Polyline to generate the complete path.


3. Results Comparison
Galapagos tends to generate longer paths and may allow steeper segments. It is more parametric and flexible — since the fitness function can be applied both globally and to individual parameters, it allows scenario-based control (e.g., a forest bike trail with a maximum slope limit or a walking route with an approximate total length). However, it is less precise in strict slope control.
The Anemone script produces a sharper, less parameter-driven path but adheres more accurately to the defined slope percentage. It is better suited for cases where slope control is critical and has the advantage of finding a shorter path within the required gradient constraints.

Galapagos | Segment Slope %

Anemone| Segment Slope %
Download the scripts and Rhino test file below.
