Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

this is for rounding edges of 3d-models using hull functions

(imagine a hulled cube with spheres or torusses in the edges):

you have a irregular, triangular pyramid, which is upside down.

the tip is in the origin.

now you knock the base out and put a ball in.

where is its center going to be ?

you do the same with a torus.

that's basically it.

given are 3 plains, cutting through the origin

and the radios of the sphere

the torus lies flat on the second plane

and the adjacent planes can also form a "v", if looked at from above,

which makes the torus stick to the side of the pyramid.

given are 3 plains, cutting through the origin

and the 2 radiuses of the torus

my approach, at first with the sphere, would probably be:

cutting the three planes,

going a equal distance on the cut vectors,

taking the average.

as a vector, this would point to the center of the sphere, right ?

if i could, with the normal vector of a plain,

span a rectangular triangle, with the center of the sphere

in the upper edge, i could solve it with trigonometry, right ?

before i go through it, are there more straight forward approaches ?

with the torus it gets more complicated

and i probably would have difficulties i solving that.

does somebody have a hint for me ?

Offline

**Jai Ganesh****Administrator**- Registered: 2005-06-28
- Posts: 46,752

Hi mathdrop,

Please see this forum rule:

**Make Yourself Understood.** It is ok to sometimes use shortened words such as gr8, but too much of this will classify your post as spam.

This is just a friendly reminder.

A reply would soon be given for the problem given by you.

It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

hi mathdrop

Welcome to the forum.

I'm calling the triangular 'base' ABC, the centre of the sphere O* and the three points of contact P, Q and R.

As the triangular faces of the pyramid slope inwards, P, Q and R must lie on the sides AB, BC and CA; let's letter them so that P is on AB, Q on BC and R on CA.

These sides must also be tangents to the sphere so the line through P perpendicular to AB must go through O and similarly for the other two points of contact. And PO = QO = RO = radius of sphere.

Is that enough to identify where P, Q and R lie? I think so but I'd like to try it with some actual values.

So please suggest 3D equations of AB, BC and CA and a radius for the sphere.

No idea yet for a torus as I cannot decide how it will make contact. Here again an equation would help.

Bob

* I'd normally use O for the origin but I don't think it matters for this problem; everything hinges on the base lines. The problem would be the same if you took away the pyramid and replaced it with a wire frame ABC suspended in space.

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

hello @ganesh, i've read the rule and thought i would follow it.

please send me details about your complain.

should i for instance type "i have" instead of i've ?

is there a more detailed nettiquette ?

hello @Bob, thank you for helping. you got my definition right.

as requested,

i tried to choose some numeric values for a test:

AB:x=r(2|-3|1)+s(-2|-3|1)

BC:x=t(2|0|1)+u(0|2|1)

CA:x=v(-1|0|1)+w(0|1|1)

(would we need them in the hesse normal form ?)

r_sphere=.5

the torus would lie flat on BC,

so BC and the the torus have a circle

with r=R_torus_core in common.

but it touches AB and CA just in a single point each.

r_torus_rounding=.5

R_torus_core=1.5

Offline

**Jai Ganesh****Administrator**- Registered: 2005-06-28
- Posts: 46,752

Hi mathdrop,

It is not a complaint. It is expressing oneself clearly.

'I've' and 'I have' is perfectly okay, but 'i've' isn't appropriate.

Take your time, for the change.

It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

hi mathdrop,

Thanks for replying. A straight line has an equation of the form

where **a** is the position vector for a point on the line, **b** is a vector in the direction of the line and t is a parameter.

As your equations have two parameters (2 degrees of freedom) they define a plane. I wondered if I could use them as the equations of GAB, GBC and GCA where G is the origin but it would be better if the vectors were for **AB, BC ** and **CA**.

After playing around a bit with that, I decided it would be easier to just pick vectors for **AB, BC ** and **CA** at the start.

Even with that I rapidly got into equations with 9 unknowns. But, because of my initial choices the coordinates of O, the centre of the circle, came out easier than I expected. As you will see I still have two unknowns so I haven't been able to uniquely determine O, but I've got close. I'll post what I've done and maybe you'll have some ideas.

Step 1. Choose vectors for **AB, BC ** and **CA**. To save time with the typing I won't keep trying to write the vectors with an overline or in bold.

If AB is a tangent to the sphere then the line from P to the centre must be at right angles to AB. In 2D it would be possible to write a single vector with numbered components for this, but in 3D it's not that simple. Imagine a circular disc pierced by a stick at the centre, at right angles to the disc. Any radiating line in the disc is at right angles to the stick so there are an infinite number of these. But the dot product https://www.mathsisfun.com/algebra/vect … oduct.html enables us to write a general form for these.

Step 2. Write vectors perpendicular to AB, BC and CA.

Now I'll get vectors for AP, BQ and CR where P, Q and R are the points where the tangents touch the sphere.

Step 3. Now to get vectors for AO, BO and CO where O is the centre of the sphere.

Step 4. Finally, as AO = AB + BO and AO = AC = CO I can obtain three versions of AO and these must be equal.

Comparing the x and y components in the second version shows that x = -y and the y and z components in the last, that y = -z.

So

Therefore

As PO is the radius we can use Pythag to write

That's as far as I've got for now. I'll have a check to make sure I haven't slipped up anywhere and try to work out where that leaves us.

Would you believe I've only just thought that all the coordinates ought to be positive. Unfortunately that makes the calculations a lot harder. Apparently you can plot this using Geogebra, so I'll try that first as a way of confirming the process. If that works I'll try alternative coordinates.

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

@garnesh: Got it.

@Bob: You're welcome. I see you start out with lines, which I do with planes.

Regarding your first and second reply:

Since it is an irregular triangle a line trough the origin, touching the sphere

might not be perpendicular to a line representing a base side.

Or do you think otherwise ?

I tried to put it mathematically:

Is every line, representing a base side and touching the sphere,

perpendicular to the line going through the origin and touching the sphere,

which it crosses, for all irregular triangular pyramids ?

It might work with regular pyramids, tough,

but how would we get to irregular ones from there ?

Following my approach would look like this:

Fist I rename my planes real quick

(starting with E cause German "Ebene", which means plain): AB=E, BC=F, CA=G:

```
Vectors: Hesse Cartesian:
E:x = r( 2|-3|1)+s(-2|-3|1) E:x = (-2x-2y+4z)/sqrt(24) = 0
F:x = r( 2| 0|1)+s( 0| 2|1) F:x = (-x+y-z) /sqrt(3) = 0
G:x = r(-1| 0|1)+s( 0| 1|1) G:x = (-4y-12z) /sqrt(24) = 0
```

Plane intersection lines:

EF:x=r(1|3|2)

EG:x=r(1|-3/5|-1/5)

FG:x=r(1|3/4|-1/4)

Their average vector: V:x=r(1|3.15|1.55)

It should go right through the center of the sphere, right ?

Cause it's lovely out there, I will continue later.

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

Even easier.

Forget the Plane intersection lines, forget the average vector.

Since we know, that the plain touches the the sphere, witch has a known radius,

we make a parallel copy of each plane, so that they go right trough the center of the sphere.

Since we have 3 planes, we can solve for the coordinates.

```
Hesse Cartesian:
E:x = (-2x-2y+4z)/sqrt(24) = 0.5 = radius of sphere
F:x = (-x+y-z) /sqrt(3) = 0.5 = radius of sphere
G:x = (-4y-12z) /sqrt(160) = 0.5 = radius of sphere
```

Now solve those equations for x, y and z:

solve([(-2x-2y+4z)/sqrt(24)=0.5, (-x+y-z)/sqrt(3)=0.5, (-4y-12z)/sqrt(160)=0.5], [x,y,z])

The numeric solution is:

centerpoint of sphere

= ((1/18)*(-5*sqrt(3)-4*sqrt(6)-sqrt(10)) | (1/6)*(sqrt(3)-sqrt(6)-sqrt(10)) | (1/18)*(-sqrt(3)+sqrt(6)-2*sqrt(10))

≈ (-1.2011 | -0.64662 | -0.31151)

Edit: I've corrected the mistake of putting sqrt(24) instead of sqrt(160) in G.

*Last edited by mathdrop (2022-03-13 06:11:52)*

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

Taking on the torus:

Similar to how I made the 3 planes meet at the center of the circle:

One could slice the torus horizontally with (the second) plane, on which it lies flat.

One could slice the core circle with the other planes (we probably need just one).

The intersection of those gives us a vector, which touches the core of the torus

(due to the shifting, it does not necessarily go trough the origin).

There it is perpendicular.

Since we just have the radius and no other distance/angle,

we probably can not go straight for trigonometry at this point.

The unused plane probably wouldn't be of any help, too, or would it ?

Any ideas ? :-)

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

One could calculate the angle

between the two intersection vectors, which touch the core of the torus

(and divide it by 2 for getting an angle of said triangle).

Then one could use trigonometry for calculating the coordinates of its center.

Is this the easiest way ?

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

hi mathdrop,

I'm still working on the sphere question and looking at your post 8.

The Hesse equation has the form

where r is the equation of the plane, n a vector normal to the plane and d the distance from the origin.

I don't follow where your equations come from.

If you knew r, and could translate the plane along the normal a distance of 5, then you would have a plane that goes through the centre of the sphere. But why are your equations correct?

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

Thank's for explaining.

Regarding the order in which I took the points above the origin,

I followed no rule, therefore some normal vectors pointed in the wrong direction.

Some mistakes later, I took the right hand rule

(for this I made multiple edits of this post,

to avoid posting a bunch of my mistakes

and therefore possible confusion).

Starting all over.

This time with the same numbers

except I flipped B2 and B3 as well as C2 and C3 for correctly

using the left hand rule, so the normal vector should point inwards,

into or through the (upside down irregular triangular) pyramid:

Here, the first point in every plain

is the origin=A1=B1=C1=0v=the v(ector) 0 .

Points:

A1=(0|0|0), A2=(2|0|1), A3=(0|2|1)

B1=(0|0|0), B2=(0|1|1), B3=(-1|0|1)

C1=(0|0|0), C2=(-2|-3|1), C3=(2|-3|1)

A1A2=A2-A1=A2 and so on.

Therefore:

A:x=r*A2+s*A3=r*(2|0|1)+s*(0|2|1) and so on (see post 4 except flipped).

Doing the cross product for getting the normal vectors n:

A2 X A3 = (2|0|1) X (0|2|1) = (0*1-1*2|1*0-2*1|2*2-0*0) = (-2|-2|4)

B2 X B3 = (1|-1|1)

C2 X C3 = (0|4|12)

Taking the length's |n| of the vectors n for the Hesse stuff later:

|(-2|-2|4)|=sqrt((-2²)+(-2²)+4²)=sqrt(4+4+16)=sqrt(24)

|(1|-1|1)|=sqrt(3)

|(0|4|12)|=sqrt(160)

The normal form:

A:(-2|-2|4)*(x-0v) and on.

Multiplying this out to get the Cartesian form:

(-2|-2|4)*(x|y|z)-(-2|-2|4)*(0|0|0)=0 and on.

Normalizing following Hesse:

A:-2x-2y+4z=0 -2x-2y+4z/sqrt(24)=0

B:x-y+z=0 x-y+z/sqrt(3)=0

C:4y+12z=0 4y+12z/sqrt(160)=0

Since I figured, that I can jump over the Hesse form,

like you portrayed it, I have not even looked up,

how to get there again. How, by the way ?

The 3 planes have a single point in common.

Since they all touch the sphere, it is in its center,

if they are shifted towards there by the radius of the sphere:

A:(-2x-2y+4z)/sqrt(24)=0.5=radius of sphere/sqrt(24)

B:(x-y+z)/sqrt(3)=0.5=radius of sphere/sqrt(3)

C:(4y+12z)/sqrt(160)=0.5=radius of sphere/sqrt(160)

I brought it in this solve grid:

2/sqrt(24) |2/sqrt(24) |-4/sqrt(24) 0.5

[1/sqrt(3) |-1/sqrt(3) |1/sqrt(3) ] = [ 0.5 ]

0/sqrt(160)|4/sqrt(160)|12/sqrt(160) 0.5

From there or from

solve([(-2x-2y+4z)/sqrt(24)=0.5, (x-y+z)/sqrt(3)=0.5, (4y+12z)/sqrt(160)=0.5],[x,y,z])

I've let the computer take over (equal results).

Now it gives me:

center of sphere

= ((1/18)*(5*sqrt(3)-4*sqrt(6)+sqrt(10)) | (1/6)*(-sqrt(3)-sqrt(6)+sqrt(10)) | (1/18)*(sqrt(3)+sqrt(6)+2*sqrt(10)))

≈ (0.11248 | -0.16988 | 0.58367)

Is there something left to explain in more detail ?

Would it work, with displacement vectors included in the plains, accordingly ?

Would it make sense to adapt our definitions somehow,

so that our models represent similar scenes ?

Edit's to avoid confusion: Using the right hand rule, so flipping B2 and B3, C2 and C3 (see beginning of post).

*Last edited by mathdrop (2022-03-15 07:27:48)*

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

Since I had some faults there,

I checked if it works with displacement vectors,

and it does.

One should not forget to add the dot-products

of the cross-products and the displacement vectors

divided by their length's

to the right side of the solution grid, here.

My OpenSCAD code does also render it correctly

(I have been using the BOSL2 library, cause solve):

```
use <~/.local/share/OpenSCAD/libraries/bosl2/std.scad> // linear_solve
module spherepolyhedron(corners)
{
module cornerput(corner)
{
//[[x,y,z],[[x,y,z],[x,y,z]],[[x,y,z],[x,y,z]],[[x,y,z],[x,y,z]],r_sphere]
tip=corner[0];
plainp=[[corner[1][0],corner[1][1]], // plainp(oints)
[corner[2][0],corner[2][1]],
[corner[3][0],corner[3][1]]];
r_sphere=corner[4];
plainv=[[plainp[0][0]-tip,plainp[0][1]-tip], // plainv(ectors)
[plainp[1][0]-tip,plainp[1][1]-tip],
[plainp[2][0]-tip,plainp[2][1]-tip]];
crossp=[cross(plainv[0][0],plainv[0][1]), // crossproducts
cross(plainv[1][0],plainv[1][1]), // zero if vector=0 or paralell
cross(plainv[2][0],plainv[2][1])];
vleng=[norm(crossp[0]), // vectorlength's
norm(crossp[1]),
norm(crossp[2])];
nlizedv=[crossp[0]/vleng[0], // normalized vectors
crossp[1]/vleng[1], // crossp=0 produces X/0 -> nan here
crossp[2]/vleng[2]];
matrix=nlizedv;
vector=[crossp[0]*tip/vleng[0]+r_sphere,
crossp[1]*tip/vleng[1]+r_sphere,
crossp[2]*tip/vleng[2]+r_sphere];
pos=linear_solve(matrix,vector); // bosl2 library
translate(pos)
sphere(r_sphere);
}
for(corner=corners)
cornerput(corner);
}
spherepolyhedron( // the points i have defined before
[[[0,0,0],[[2,0,1],[0,2,1]],[[0,1,1],[-1,0,1]],[[-2,-3,1],[2,-3,1]],.5]]);
*spherepolyhedron( // centerpoints of spheres in the edges of a unit cube
[[[0,0,0],[[0,0,1],[1,0,0]],[[0,1,0],[0,0,1]],[[1,0,0],[0,1,0]],.05],
[[1,0,0],[[0,0,0],[1,0,1]],[[1,0,1],[1,1,0]],[[1,1,0],[0,0,0]],.05],
[[1,1,0],[[1,0,0],[1,1,1]],[[1,1,1],[0,1,0]],[[0,1,0],[1,0,0]],.05],
[[0,1,0],[[1,1,0],[0,1,1]],[[0,1,1],[0,0,0]],[[0,0,0],[1,1,0]],.05],
[[0,0,1],[[1,0,1],[0,0,0]],[[0,0,0],[0,1,1]],[[0,1,1],[1,0,1]],.05],
[[1,0,1],[[1,0,0],[0,0,1]],[[0,0,1],[1,1,1]],[[1,1,1],[1,0,0]],.05],
[[1,1,1],[[1,1,0],[1,0,1]],[[1,0,1],[0,1,1]],[[0,1,1],[1,1,0]],.05],
[[0,1,1],[[0,1,0],[1,1,1]],[[1,1,1],[0,0,1]],[[0,0,1],[0,1,0]],.05]]);
```

Edit: Linking OpenSCAD page.

*Last edited by mathdrop (2022-03-15 12:15:37)*

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

That's great! I'm glad you got it sorted.

Bob

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

What about the torus ?

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

It seems, that I got it sorted, too.

Mainly I did like I described above.

Before the torus I dropped a ball with its rounding as radius.

Its center gives you the displacement due to shifting.

Not to forget to tip an turn the radius.

It's just the dot product used with

unit vectors in direction of the axes (e.g. z and y)

and the normal vector of the plain

on which the torus rests flat.

Edit: putting z and y instead of z and x.

*Last edited by mathdrop (2022-03-25 12:45:05)*

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

I had a go at the sphere problem and was finding it tough to get to the end. So when you said you had done it I was very relieved.

So, if you think you can finish the torus problem, that's an even bigger relief for me. Phew!

Bob

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

Without you motivating me,

I probably wouldn't have solved this yet.

Something I might add:

Till here it worked on paper, but for using it with my computer,

I was putting back the floor plus, in the torus planes edged, balls trough it,

so that their center is in the floor plane.

This by shifting the 2 planes next to the edges, one of which the torus lies flat on,

with the floor plane by the radius of the ball.

Cutting the planes in each of the 2 cases gives unique points.

Instead of with the lines, coming out of the equation systems,

I defined the vectors, which intersect the core of the torus

using the balls in combination width the one on the tip.

This way I avoided an underdetermined bosl2 solve,

resulting in the minimum norm solution (point on line, closest to origin).

It made sure, that the vectors always point in the right direction.

Edit: Being more specific

*Last edited by mathdrop (2022-05-04 21:59:10)*

Offline

**mathdrop****Member**- Registered: 2022-03-07
- Posts: 75

You're not alone if you do not like linear algebra that much,

but what is geometry without it ?

Maybe I also could have explained it better. It is planeshifting after all.

Is it that I lost you with Hesse Cartesian (or normalized Cartesian equation),

which is the Cartesian version of the Hesse normal form ?

You are almost there, there. Is this one what you call "post 8" ?

There should be English equivalents, but can you follow the mathematical steps of the Germans, there ?:

- Longer German version of the English Hesse normal form Wikipedia site

Point-plane-distance by Hesse Cartesian examples:

- "Daniel Jung" tutoring

- "Simpleclub" aiming at young students

What did you do, when students bailed out on something,

you planed to build on, by the way ? ;-)

Offline

**Bob****Administrator**- Registered: 2010-06-20
- Posts: 10,475

Do you mean if the student(s) doesn't 'get it' and doesn't want to try?

I once had to take a special needs class doing a coursework task; the object being to investigate then arrive at an algebraic formula. I brought in some sweets of different types and presented the task as involving the sweets as a prop. It went down well and they quickly got the idea making up packs of mixed sweets according to the 'rule'. They were able to write their 'conclusion' in terms of a 'formula' using the names of the sweets instead of x and y.

The final step was to persuade them to re-write this, abbreviating each sweet name to it's start letter. Result: one perfectly respectable algebraic conclusion.

So, I suppose my answer is 'find a way to present the work using their language/interests/culture'.

Bob

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Sometimes I deliberately make mistakes, just to test you! …………….Bob

Offline

Pages: **1**