Creating Geometry Based On Defined Constraints: Please Help


Hi. First-time caller, here.

In the attached diagram, left side, pink rectangles i and ii are fixed at the given dimensions and must conform to the confines of the box beneath such that:
• point ‘a’ touches side ‘1’, point ‘b’ side ‘2’, g-3 and h–4
• points d and f remain in contact

The pink rectangles represent the top edges of 2 panels, whose third dimension is 120cm.
Finding the angle empirically would be a relatively simple matter of hinging the panels at x and opening them until they fit the defined constraints.

In Sketchup, however, it’s a tedious game of trial and error; rotating and moving and aligning by eye.

The spirograph-esque pattern on the right is the product of rotating each rectangle independently in 1º increments through its range of motion while conforming to it’s bounding-wall constraints. (tedium factor: 8)

I arrived at the hideously pink diagram by taking the two rotations whose d and f points were in closest alignment and tweaking from there. (tedium factor: 5)

How can I build this geometry quickly and with numerical precision? Plugins? Process?
(My trig and geometry games are weak)



I am not quite clear where you are going with this, Are you trying to work out the min to max size of the container, which would be square ranging from 65 to 91.924 then a rectangle ranging down to 5x60
Or do you need to know the position of the pink for a given container size within this range?


The container is a fixed size.

Maybe it’ll clarify things if I present the problem in it’s real-world context:

The Hideous Pink from the first post are now the two large panels in the corner of the room and the grey box is the green square. The panel dimensions are actually 24" × 48" × 2".

The leading outer edge of each panel must be 6" from the edge of its corresponding window opening.

I’m building a wooden frame to hold these panels in place.
I’d like to do it numerically so that I may measure twice and cut once.
I could do it empirically but I’m feeling stubborn and I see this as a good opportunity to up my Sketchup game.


In this drawing (from another room) the frame—also eyeball-accurate— offsets the panels from the wall. The frame for this room will be identical save that they will hold the panel edges flush to the wall instead of offset from it.


The problem in drawing circles in SketchUp is that because they are made from ‘segments’ their intersections do not return a true point on the circumference unless it’s coincidentally on a node of two segments.

My ‘Tanget-Tools’ includes several tools including one to get the true intersection of two circles/arcs.
It’s code places guide-points but the returned values can be got using the same trig algorithms.
There are never more that two mirrored intersections.
There might be no intersections depending of the box shape/size relative to the panels’.
E.G. the box’s diagonal is >2x the panels’ diagonal; or the box’s sides are < 5 or 60cm…
The radius of the two circles you need is actually Math.sqrt(52+602) [~60.207…] - i.e. the diagonal of the panels.

The location of the center pivot point of these two radii is variable as the ends slide between the sides at a-b and g-h.
However, the location of b is between 0 and 5cm offset along side #2, and similarly g offsets along side #3 between 0 and 5cm.
So that limits the possibilities.

But I can see no calculable solution - you need to iterate a set of points for b and g and test for intersections of the diagonals.
In code this could be done quickly.

I’d be interested to see if anyone has a non-iterative solution - but since points b & g are variable along the box’s edges, I don’t see how ?


I know the geometry is possible in this case because I’ve held the panels up against the wall in the physical world. There also seems to be only one solution that satisfies all five relationship pairs. (a-1; b-2; g-3; h-4; d-f)

I feel as though in SolidWorks you could define the relationships and the model would build itself.


for something similar, where perfection isn’t required, I tend to use a locked baseboard and dimensioned crosshairs…

It’s more accurate on a larger drawing window, as the gif size affects the snap length…



That’s a cool idea, John. I’m a give it a shot.


You can quickly get within 1/32" or so with just the arc tool.



I won’t go into the details of how I arrived at this, but the solution obtained using trigonometry is:

Hopefully, this will help you move along on your project.


Okay, that does it— I’m signing up for Khan Academy right now.*
Thanks, Jim, that was incredibly helpful!
As as these things go, was this a particularly difficult problem to solve?



Can you explain what the process would be?


This is one of those cases where the native SketchUp tools don’t easily produce an exact answer. However, for your project, I feel that finding a solution within 1/32" (as Shep suggested) would be quite sufficient (so says the carpenter in me). On the other hand, it’s frustrating not to be able to find an exact solution (so says the engineer in me).

As these things go, was this a particularly difficult problem to solve?

Yes and no … Yes, because as TIG pointed out, this is probably not solvable directly and probably requires an iterative solution. Having solved many similar problems, I used Shep’s approach and started with a close approximation.of the final solution. Measuring the angles A and B gave me starting values for brute force iterations to home in on the solution:

Referencing A and B allowed me to piecemeal the trig equations … going down the left hand side:

2cos(A) + 24sin(A) + 24sin(B) = 32.625

Similarly, across the bottom side:

24cos(A) + 24cos(B) + 2sin(B) = 35.875

I picked C as the language to use for the calculations (for the speed) and tweaked the loops by hand each iteration. Below is the code with the final values I used (angles are in radians):

#include <stdio.h>
#include <math.h>
int main(void)
  double a,b,s1,s2;
  for(a = .44;a <= .45;a=a+.00001)
    for(b = 1.02;b <= 1.03;b=b+.00001)
      s1 = 2.0 * cos(a) + 24.0 * sin(a) + 24.0 * sin(b);// = 32.625
      s2 = 2.0 * sin(b) + 24.0 * cos(b) + 24.0 * cos(a);// = 35.875
      if((s1 > 32.6249 && s1 < 32.6251) && (s2 > 35.8749 && s2 < 35.8751))
        printf("a = %f / b = %f / s1 = %f / s2 = %f\n",a,b,s1,s2);
  return 0;

The output of this run is

a = 0.445290 / b = 1.022560 / s1 = 32.624924 / s2 = 35.874937
a = 0.445300 / b = 1.022550 / s1 = 32.625006 / s2 = 35.875028

I decided the second line was “close enough” and then translated the angles back into degrees and created the geometry in SketchUp.

You mentioned SolidWorks and I seem to recall using something like that before where you could restrict the movement of one corner of the frame to slide along one wall while the other corner had to stay in contact with the other wall. Rotating the piece would produce the motion you need to use to calculate the intersection.

Anyway, this was an interesting problem. Thanks :slight_smile:


Thanks for posting your approach! I had arrived at the same pair of trig equations but after beating my head against them for quite a while couldn’t find a way to solve them explicitly. The fact that you needed to use an iteration eases my mind!


Here’s another approach using the UV PolyGen plugin that allows this problem to be readily solved within SketchUp.

Using the diagram I posted earlier, the two curves that would be traced by the ends of the panels can each be parameterized in terms of the angles A and B. Although the plugin is designed to create UV surfaces, you can cheat by setting the V length to 0 and use it to create a group of line segments instead:

By using the following parameters, curve A is created using 1000 points:

Similarly, B is created using:

The intersection of these two “arcs” is accurate on the order of a few ten-thousandths of an inch.

Here’s the numbers and equations in cut-n-paste format:

PI/2 ~ 1.570796

X = 24.0 * Math.cos(u)
Y = 32.625 - (2.0 * Math.cos(u) + 24.0 * Math.sin(u))

X = 35.875 - (2.0 * Math.sin(u) + 24.0 * Math.cos(u))
Y = 24.0 * Math.sin(u)

I’ve also attached the model with the arcs in SketchUp 8 format: panel_arcs.skp (100.1 KB)


Hey, everyone,
Sorry to have seemingly abandoned this post without expressing my gratitude for your efforts!
Sadly the company I was working at folded and the room that we built has since been torn down but I’ll try to find some photos of the room when it was done.
Thanks for all your help!


Sorry to hear that . . another place down sizing !