The next thing I need to do is take a handrail profile such as the image on the left which is a cross section of a handrail for level handrail.
Then I want to create a sorted array of the edges used to describe the level handrail profile. - I'm thinking the outer_loop should work.
Then I stretch the profile based on the slope of the handrail - just store the vertices in an array. After that I rotate the vertices the appropriate amount for the next section of handrail. Create edges that go from the first adjusted profile to the next section of profile.
The catch is that these handrails may not have a consistent slope. There may be a small section of handrail that transitions from one slope to another. For instance there could be a tight radius for the inside stringer that has a steep slope and then over a couple of feet at the top of the stair the handrail levels out for level balcony handrail. This means that I have to adjust the profile for the handrail for each small section.
I'm thinking of using the top center of the handrail for registration purposes. This makes sense to me as building codes talk about the height of the handrail for level rail and for stair rail. Residential codes are usually 36" for level handrail and 32" for stair rail - measured vertically up from the edge of the tread nosing. Commercial codes are usually 42" and 36" respectively. The top center is consistent regardless of the height of the rail profile.
Handrail profile