TrueBend Plugin Question

Dear SketchUppers,
playing around with ThomThom’s TrueBend plugin, I cannot understand what exactly the Bend by Distance function does. Hoping for someone to enlighten me on this.

Say in this example above, what exactly is 15 cm? Whatever I measure after executing the command, there seems to be no 15cm.

And a second question please - on the plugin’s GitHub page, ThomThom wrote:

But I can’t find a way to bend the mesh to a specified radius.
Thanks for any input.

P.S. Here’s the file just in case - TrueBend Experiment.skp (27.2 KB)

I couldn’t find the 15 cm in your example too, maybe @thomthom can shed some light on this length?

1 Like

How about 30 cm divided by 2 which is the segment length that needs to be bent ? !

1 Like

The “Distance” is a bit weird as-is. I’d originally wanted this distance to be the Sagitta of the bend. https://en.wikipedia.org/wiki/Sagitta_(geometry)

But it wasn’t as trivial to compute the curve based on the sagitta distance.

I probably should have made bending by degrees the default option.

You can switch to degrees by typing post-fixing “deg” in the VCB - for example: 60deg
You can switch back to Distance by post-fixing a lengt unit. This is similar to how to switch between controlling AOV or Focal Length when operating the Zoom tool.

For those who are curious to what the Distance currently represent:

Given distance of the bending axis - in the example above: 360cm - this becomes the circumference of a max bend (360°). This is then used to compute the radius of the max-bend (in this case 57.296 cm). When you grab the handle to start bending the tool takes the world distance from the first pick and second pick as a reference distance. Let say you drag the Drag Handle 40cm.
It will then take the drag distance * 0.5 and divides that by the max-bend radius to produce a ratio. This ratio is in turn used to produce an angle for the bend (360° * ratio).

Why this random set of numbers and units? Because I wasn’t able to make the Sagitta work. I then just focused on making the dragging experience somewhat sane. I was mainly after setting a degree if I needed precision, so I just called it quits. This was after all an experiment that was suppose to only take half a day - which in the end ate up a few weeks. (Completely spoiling my own promise to myself of not starting a new project without finishing the current one.) I also figured this was such a niche thing that no-one would really care and I should just get back to my original project ASAP.

I logged a not for myself to change the default to bend by angle:

Also to update the README:

7 Likes

Thomas, thanks so much for taking the time and writing all this. I can only imagine what a tedious job creating a plugin is.
That said, I believe the default already is to bend by angle no?
At first I did intuitively think that the distance ought to be something like the sagitta but the measurements didn’t match.
It’s a pity the sagitta intention didn’t work; the plugin is really powerful and really popular in the community as you know. :relaxed:

Actually - you are correct. I’d read my own code wrong. :joy:

I’m not that great at math, and it took me a long time to realize that resolving a circle of a given circumference and a given sagitta is non-trivial. I might return to this and try to resolve it by iterative approximation, but… time will tell…

I hadn’t really expected it to be seen as particularly useful. Especially since you already had Shape Bender and FredoScale’s Radial Bend. Guess it was a good thing I released it instead of just leaving it on the shelf. :slight_smile:

4 Likes

Have you come across my post back from November? I was trying to model a meticulously perfect spiral stairwell with its edges aligned to the axes. None of the plugins you mentioned really helped to achieve the perfectly aligned look I was going after (you can see the screenshots displaying each problem every individual plugin brought with itself). I think I also used your TrueBend somewhere in-between the experiments because it’s one of the very rare plugins that would allow me to align the stair edges properly. However, because you can’t specify a radius, the plugin didn’t do much help in that particular mission. I did use a lot of Clean-Up though. I think TrueBend has a massive potential. Glad you released it. :slight_smile:


# Create an arc, normal to the Z axis
start_a = 5.0.degrees
end_a = 80.degrees
model = Sketchup.active_model
entities = model.entities
radius = 46
edges = entities.add_arc(ORIGIN, X_AXIS, Z_AXIS, radius, start_a, end_a)
# sagitta - same as bulge
arc_curve = edges.first.curve
start_pos = arc_curve.edges.first.start.position
end_pos   = arc_curve.edges.last.end.position
chord     = start_pos.distance(end_pos)
sagitta   = radius - (Math.hypot(radius, chord)/2)

Don’t think I saw that post, no.

I do have an issue logged to be able to enter Radius. But with a note that I thought it might be similar challenge as entering sagitta. https://github.com/thomthom/true-bend/issues/23
(That kind of surprises me reading it now - but it’d been a while since my head was in this, so its a good chance former-me knows best on this one.)

The challenge is that you want to keep the arc-length fixed while providing another unit of reference to dictate the size of the bending arc-curve.

Given sagitta and circumference - how do you derive radius and angle?

the arc tool does it, can’t you look at it’s code…

I may have a snippet somewhere, i.e. to deconstruct Math.hypot

john

? I don’t recall the Arc tool allowing the user to input circumference limitation … ?

TwoPointArc allows you to enter ‘Bulge’ which is the same as ‘sagitta’ commonly known as sag…

edit: I don’t do maths either, but played around with this 5 years ago for something…

I often call @jimhami42 when it all gets to much…

john

But it doesn’t keep the arc length fixed. That’s a constraint TrueBend was designed to enforce.

1 Like

Once you decide Arc Length is to be fixed and you have sagitta then you can get radius or circumference.

Circumference = 2PI()r

You can get Angle by imagining a right triangle under the Arc with one corner at one end of the arc and the other at the center of the circle associated with the arc.
image
a = top side = half Arc Length
b = left side = Radius - Sagitta
Angle = atan(a/b)

if this is true then

def angle4tt(length, sagitta)
    #length = Arc length
    #formula from  https://en.wikipedia.org/wiki/Sagitta_(geometry)
    radius = (sagitta / 2) + ((length * length) / 2 * sagitta)
    
    #right triangle maths to calc Angle . triangle between circle center and one arc end point where a is  length of topside and b is other non hypotenuse side 
    
    a = length / 2  #length of topside od triangle
    b = radius - sagitta  # length of downward side of triangle
    angle4tt = Math.atan(a/b).radians
    
end

Sorry … that code doesnt implement the theory which appears to be tru by my testing.

this code does better to allow the Arc Length and Arc Sagitta as an input and get the full wide Angle as an output

def angle4tt(length, sagitta)
    #length = Arc length
    l = length / 2
    #formula from  https://en.wikipedia.org/wiki/Sagitta_(geometry)
    radius = ((sagitta * sagitta) + (l*l)) / (2 * sagitta)
    #radius = (sagitta / 2) + ((l * l) / (2 * sagitta))
    #puts radius
    #right triangle maths to calc Angle . triangle betwwen circle center and one arc end point where a is  length of topside and b is other non hypotenuse side 
    
    a = length / 2  #length of topside od triangle
    b = radius - sagitta  # length of downward side of triangle
    angle4tt = 2 * Math.atan(a/b).radians
    
end
2 Likes

That doesn’t look correct to me. That appear to take the projected half length of the arc curve… :thinking: