How to bisect an angle formed by two lines?

I need a vector that bisects an angle formed by two lines that intersect at a point at one end of each of the lines.

I know I can construct that by creating a unit parallelogram and getting the vector to the opposite point.

But is there a predefined function that does this? It seems a useful enough thing that it might exist – after all, there is a function to find the points of closest approach of two non-intersecting lines. Or maybe it’s been deemed so simple that it doesn’t need it’s own function.

Or is there an even simpler way than creating a parallelogram?

I’ve been poring through the SketchUp Ruby doc and not finding anything.

Any suggestions?


In case you’re wondering what this is for, I’m creating a curve that twists through 3D space and at each intersection of the segments I want to be able to point towards the “instantaneous” center point of the circle defined by every pair of segments. Then connecting the ends of the lines will make a ribbon.

Hi August, hope you are doing well!
Is the curve going to be made out of segments of equal lengths?
If not, the vector doesn’t bisect the angle into two equal angles.

Could you attach a sketch of part of the curve that you are after, a habd drawing? with some notes?

You have the common vertex position [point0] shared by the two edges.
For those two edges you can then use their other vertex positions [point1 and point2] to determine their vectors.


The angle between them is given by:


To find the ‘axis’ of rotation:


Make a rotated copy of vector1 about point0 - called bivector:

tr=Geom::Transformation.rotation(point0, axis, biang)

I haven’t tested any of this… so play around with ± biang etc…

1 Like

Geom.linear_combination(0.5, first_vector, 0.5, second_vector) is what I typically use. Note that one vector needs to start at the corner and the other end at it. If both either starts or ends at the corner one will need to be reversed.

Thanks Gerrit. Life is up and down and mostly good. Details off this thread.

As for the equal length segments, that’s why I used the term “unit parallelogram” describe making a teporary construction where everything was of length “1”.

Thanks TIG, thanks Julia,

I think TIG’s “vector1.angle_between(vector2)” is in the direction that I was asking about. I’ve used “angle_between”, but I hadn’t really grasped “cross” as being perpendicular to the plane defined by the two you’re crossing and had not thought of using that as a rotation axis. Instead I was trying to do something that just stayed in the defined plane. I think I will have a need for “cross” in just a couple of further steps in this project.

At this point I think Julia’s “Geom.linear_combination(0.5, first_vector, 0.5, second_vector)” is the elegant solution that I didn’t even know to ask about. It appears to get me there in a single step. It also appears to be a generic solution to a wide variety of problems.

None of this showed up in my poring over the doc because I kept looking for operations to apply to lines and not vectors. Of course vectors is the way to go, because this is all internal calculations, not drawing elements. That’s what happens when I think in Ruby too much like I would draw it out in SU. I was already on and as soon as I clicked on Vector3D, there was
.linear_combination(weight1, vector1, weight2, vector2) ⇒ Object
at the top of the list, followed closely by #cross and #angle_between.

And as for Gerrit’s other question, no, the curve cannot be counted on to be of equal length segments. It’s generated by a parametric formula where the primary parameter is an angle value that I increment in degrees (or eventually fractions of a degree) and get XYZ coordinates for the next point on the curve. I have not looked into calculating how much the segment lengths vary, but that might be interesting to look at.

Here’s a drawing I did to help me keep the points and vectors straight. I’m sticking each point, vector, and angle into an array to help keep track of them and be able easily find what is the current, previous, and next one in the sequence. Because the curve loops back to become coninuous, point[N] is the point right before point[0].

The hexagons are to help see the 3D orientation of the lines (at one point I was thinking of getting the lines that I asked about here as diameters of the hexagons, but that idea proved difficult – primarily, I think, because the construction concept had nothing to do with the actual problem and was a kludge based on my lack of knowing the right operations).

Thanks for all the help. I think I’m moving forward on this again.


Add a line to make a triangle. Select the triangle and use the Offset tool. Draw lines connecting vertex to vertex. Bingo. An automatic function is beyond me.

Thanks for the link to that thread, Gary. It has some good tips.

However, I need something automatic to do this a few hundred or maybe a thousand times. As I noted above, I think I’m on track with that now. At least for now.

Have you seen the simple, six-line Ruby script on the welcome page for ? That was the kind of thing that turned me on to coming up with automatic way to do fun things that would take way too long to do by hand.