[HN Gopher] Planes in 3D Space
___________________________________________________________________
Planes in 3D Space
Author : alexharri
Score : 118 points
Date : 2024-04-27 11:00 UTC (11 hours ago)
(HTM) web link (alexharri.com)
(TXT) w3m dump (alexharri.com)
| randv wrote:
| super cool...thanks
| shiandow wrote:
| Shame this doesn't include my favorite description, a 4d vector
| in projective affine coordinates.
|
| Instead of a normal and point or constant you get (x,y,z,1) . P =
| 0. The translation between the two is trivial. If you want a
| plane spanned by 3 points you just can use the generalized cross
| product to find P.
|
| One advantage is that you can avoid all the special cases with 3
| intersecting planes. There exists exactly 1 point that is on all
| 3 planes, but as this is in projective coordinates it might lie
| at infinity.
| boppo1 wrote:
| Do you have any good resources for developing an intuition
| about the projective plane?
| alexharri wrote:
| I haven't heard of this before, I'd be interested in learning
| more about how this is useful. Do you know of a good resource
| to read more about this?
| shiandow wrote:
| I honestly don't know, I encountered the concept during my
| study, but it took lots of practice to get comfortable with
| it. Most articles I encounter are too practical to really
| foster understanding, or too technical to work as an
| introduction.
|
| You can start with a description of how projective matrices
| work (and how translation and rotation are related to it).
| After that, best tips I can give are start with 2D until you
| can't bear to see another cross product. Then get familiar
| with Cramer's rule and higher dimensions. You'll need sone
| fluency in linear algebra.
|
| My first practical use of the concept was to rectify
| photographs where e.g. a building was not quite upright. That
| might be a good starting point.
| alexharri wrote:
| Thanks a lot, will use this as a starting point
| memco wrote:
| Are bivectors a 4th way to express planes in 3D space or is that
| what the 3rd method the article describes is. I didn't see them
| mentioned anywhere in the article. I only have a cursory
| knowledge of their existence and use so not totally sure how they
| fit, but I feel like they should.
| tsuru wrote:
| If you use 3D Plane-based Geometric Algebra
| (https://bivector.net) planes are vector elements and bivectors
| could be the line intersection of two planes. I'm grossly
| simplifying here, see link for more info on this
| interpretation. There are more algebras that have other
| interpretations of bivectors.
| mwexler wrote:
| Just to get it out of the way, I assumed just from the title that
| this was about airplanes in 3d space and was excited to see what
| I was missing, as I thought they all flew in a 3 dimensional
| context.
|
| I know I'm not the only one...
| ReleaseCandidat wrote:
| There are woodworking planes too, with which the title makes
| more sense.
| makerdiety wrote:
| > Learning about planes felt abstract and non-intuitive to me.
| "Sure, that's a plane equation, but what do I do with it? What
| does a plane look like?" It took some time for me to build an
| intuition for how to reason about and work with them.
|
| Imagine how far human society can go if people dumped the desire
| for intuition that appeals to anthropocentric sensibilities.
|
| But I guess that's forbidden dark arts and wasting time with
| trivial pursuits and stuff is the culture to adopt while you're
| in the modern day Rome equivalent.
|
| y = mx + b is enough for me.
| harshaxnim wrote:
| Anthropomorphic intuition has its advantages - it cuts down the
| ideas search space with its learnt heuristics. We are intuitive
| beings, and system 2 thinking is very deliberate and not so
| natural to us. Secondly, it might often be intractable to
| process things with sys2 thinking. That said, I don't think
| anthropomorphic intuition is necessarily static; I can learn
| new intuitive skills with enough practice - for example, a
| person grown in a tribe with very rudimentary speech cannot
| intuit how to communicate even mildly non-simple ideas, but I
| can do half a decent job very intuitively.
|
| And finally I think even if you don't care for intuition, it
| cares for you. I mean, if you play with y=mx+c long enough,
| you'll gain an intuition, intuitively. So, with these devices
| (like visualisers etc.), we're essentially trying to gain an
| intuitive understanding deliberately, which I see nothing wrong
| with. It's just meta intuition.
| makerdiety wrote:
| A preference for level two is what got us a general theory of
| relativity and, subsequently, working global positioning
| satellite technology. Having a cognitive bias toward visual
| presentations of planes in 3D and higher space leads to
| techno-scientific stagnation.
| sqeaky wrote:
| I think you have this exactly backwards. Einstein applied
| his intuition to find gaps in special relativity. He had
| built an intuition for how light works and asked what
| happened in corner cases so he could rapidly understand the
| boundaries of. Then after finding those cases busted out
| the math to create a rigorous solution.
|
| Source: https://www.britannica.com/story/how-albert-
| einstein-develop...
|
| "Level two" ? As if there is a single best way to think and
| we should all climb towards it? There are advantages and
| disadvantages to every approach. Find what works in a
| domain and keep experimenting.
| makerdiety wrote:
| Karl Marx said something along the lines of "Each man
| does a job according to his abilities." Something like
| that.
|
| I take it, then, this modern society and civilization
| wants to specialize in low level technician style work
| and wait for aliens or angels to come and do the hard
| work of inventing faster than light travel? You know,
| intuition is the best scientists and engineers can do and
| all.
| xanderlewis wrote:
| "From each according to his ability, to each according to
| his needs"
| adrian_b wrote:
| The general relativity theory was not about gaps or
| corner cases of special relativity. It was about
| extending the theory outside its domain of applicability.
|
| The theory of special relativity showed how to transform
| the physical quantities between inertial reference
| systems, i.e. systems where Newton's law of inertia is
| true. The relative velocity between the origins of such
| systems must be constant and there must be no relative
| rotational movement between them.
|
| The theory of special relativity was not applicable to
| non-inertial reference systems, like one that has an
| accelerated motion relative to an inertial system.
|
| Einstein's quest has been to find the transformation
| relations for this more general case. Together with the
| theory of the stimulated emission of radiation (1917),
| this has been the most original part of Einstein's work,
| because the previous transformations of the special
| relativity had been discovered before Einstein, he had
| just given a new explanation for them.
|
| The only intuition related to general relativity was the
| guiding principle that whatever transformations will be
| found they must lead to indistinguishable local behavior
| of the forces of gravity vs. the forces of inertia.
| cityofdelusion wrote:
| Intuition is just a starting point -- and one that changes
| with experience gained. Two students can start to learn
| piano either "intuitively" or mathematically and both end
| up at the same level of skill 30 years later. There isn't
| some linear path of progression based off where you start
| -- that's what's amazing about the human brain, it's
| incredibly parallel and mesh based.
| makerdiety wrote:
| The problem is that learning to play the piano isn't
| innovative. (So, technically, a monkey could eventually
| do it.) Because innovation is stifled by intuition.
| Particularly intuition meant to serve human ends.
|
| It's a simple equation: take away intuition and you're
| left with revolutions in technology and science.
| ReleaseCandidat wrote:
| There is an error in the line's description, any normal of a line
| is perpendicular to the line itself (all through a point of the
| line are contained in a plane perpendicular to the line, with two
| special ones, the principal normal and the binormal, as with
| every curve) and does not point "in the direction of the line".
|
| A remark: a plane has two (different) unit length normals, which
| point in exactly opposite directions (one can be obtained by
| multiplying the other by -1). This determines the positive and
| negative half-spaces in which each plane splits the 3 dimensional
| space - the positive and negative direction, which appears for
| example in the distance calculation on the site.
| gary_0 wrote:
| I was recently algebra-ing down a complex 3D algorithm to speed
| it up, and it seemed peculiar how so many things can be boiled
| down into to a crap-ton of dot products. One of the recurring
| mathematical themes of the universe, I guess.
| 11001100 wrote:
| there is a great project using multiple planes in 3D space:
| https://cybernetic.dev/cube
| jsenn wrote:
| Another useful representation is as a point in spherical
| coordinates. The polar+azimuth angles encode the normal, and the
| radius encodes the distance from the origin.
|
| This is handy because it puts similar planes nearby in space. For
| example, it allows you to efficiently cluster objects by
| coplanarity using a spatial index.
| zodiac wrote:
| Interesting, in this representation a plane is represented by
| the point on it closest to the origin, right?
| jsenn wrote:
| Yes, that's a good way of thinking about it.
| phkahler wrote:
| Fun fact. Take 4 points representing the vertices of a
| tetrahedron. Put them in a 4x4 matrix, using 1 as the 4th element
| then invert the matrix. The 4 row vectors of the result will be
| the coefficients for the plane equations of the faces of the
| tetrahedron.
|
| They'll be scaled such that the point not on a plane will
| evaluate to 1 when plugged into the equation. You can see this
| easily because multiplying the planes matrix by the points matrix
| is just plugging each of the 4 points into each of the 4 plane
| equations, and you get the identity matrix by definition.
| nbcomplete wrote:
| Due to lack of familiarity, I did not understand this
| description. I asked ChatGPT to clarify. In case it helps
| anyone else, I pasted its response below. I asked if this
| technique had a name, and it just made something up, so if you
| know what it's called please share. Feel free correct any
| mistakes. Here it is:
|
| This statement explains a mathematical relationship between the
| vertices of a tetrahedron and the plane equations of its faces
| using linear algebra.
|
| To break it down:
|
| 1. *Tetrahedron and Matrix Representation*: Consider a
| tetrahedron with four vertices. These vertices are represented
| as points in space. Each point can be described using three
| coordinates (x, y, z). These points are arranged in a 4x4
| matrix, where each row represents one point, and the fourth
| element of each row is set to 1.
|
| 2. *Matrix Inversion*: This matrix is then inverted. Matrix
| inversion is a mathematical operation that finds the "inverse"
| of a matrix, which when multiplied by the original matrix,
| results in the identity matrix.
|
| 3. *Plane Equations*: The resulting inverted matrix will have
| four row vectors. These row vectors represent the coefficients
| of the plane equations of the faces of the tetrahedron. In
| other words, each row vector corresponds to a plane equation
| that defines one face of the tetrahedron.
|
| 4. *Scaling*: The coefficients are scaled such that when a
| point not lying on a particular face is plugged into the
| corresponding plane equation, it evaluates to 1. This scaling
| ensures that the point lies outside the plane.
|
| 5. *Multiplication*: Multiplying the inverted matrix
| (representing the plane equations) by the original matrix
| (representing the vertices) essentially plugs each vertex into
| each plane equation. The result should be the identity matrix,
| indicating that each point satisfies exactly one plane
| equation, which is consistent with the definition of a
| tetrahedron.
|
| In essence, this process uses linear algebra to relate the
| geometry of a tetrahedron to the equations of its faces,
| providing a systematic way to compute the equations of the
| planes that make up the tetrahedron's faces.
| radarsat1 wrote:
| Even though it's well intended, I feel like pasting in
| responses from ChatGPT should be against HN guidelines, if
| it's not yet. Reason is, if I want that type of explanation,
| I can go and get it myself. I come here for people's personal
| comments, not to read them regurgitate what they had an LLM
| generate. And I use ChatGPT all the time so don't get me
| wrong, I just think it doesn't add a lot to the discussion
| here and takes up a lot of room.
| Terr_ wrote:
| I'm torn on this, because I don't want to have LLM stuff
| gunking everything up either, but I think there's a general
| case to be made for comments like: "For anyone who is
| confused about X like I was, I found this explanation."
|
| In other words, how would one exclude LLM regurgitation but
| permit Wikipedia quotes?
| amelius wrote:
| Ask the LLM to cite a source, then use that.
| thechao wrote:
| > They'll be scaled such that the point not on a plane will
| evaluate to 1 when plugged into the equation.
|
| Evaluating a plane equation with a point will give a signed
| distance from the point to the plane. However, unless the
| equation is normalized, the distance could be scaled in unusual
| ways that are less than useful. I think a better way to say
| this is that a point who's shortest straight line distance to
| the line is 1 will evaluate to 1, after taking the absolute
| value.
|
| The LRBni ISA had a whole set of instructions designed to take
| advantage of signed distance fields defined in both plane
| equation & barycentric forms. (That's what the bit mask for the
| lanes was for, in part.)
| a1369209993 wrote:
| > However, unless the equation is normalized, the distance
| could be scaled in unusual ways that are less than useful.
|
| > > [ _]the[_ ] point not on a plane will evaluate to 1
|
| They mean the _vertex_ (of the tetrahedron). The signed
| distance function is scaled such that the (single remaining)
| vertex that isn 't at distance 0 (by construction) will
| instead be at distance 1. So the distance is always scaled in
| a unique well-defined way (assuming not all four points are
| coplanar). Whether that way of scaling is useful depends on
| your use case, of course.
| greenbit wrote:
| "A plane in 3D space can be thought of as a flat surface that
| stretches infinitely far, splitting space into two halves."
|
| Fun fact - if you have the coefficients of the equation
| ax+by+cz+d=0 that represents your plane, you can plug any point
| (x,y,z) into the expression ax+by+cz+d, and the result will be
| positive in one half-space, and negative in the other. I think if
| you divide the values by sqrt(a^2+b^2+c^2), you end up with the
| distance from the point to the plane. Easy enough to see which
| half-space is which by plugging in the origin. I.e., if 'd' is
| positive, the origin is in the positive half.
| BenoitP wrote:
| What a wonderfully crafted piece. But a part of me can't refrain
| from saying it would have looked way more elegant and succinct in
| 3D Projective Geometric Algebra.
|
| Most of the last sections (all intersections) feel like corner
| cases, when in PGA they are one and the same.
| ngruhn wrote:
| I keep hearing this and I'm very interested. But most
| recommended resources I've seen so far are more targeted at
| Physicists. Any good text book for CS people?
|
| Edit: nevermind, read in other comments that
| https://bivector.net/ has a ton of resources.
| sebastos wrote:
| For those interested, this appears to be a really high quality
| library that provides a 3D PGA C++ API:
|
| https://github.com/jeremyong/klein
|
| I've always wanted to find an excuse to rebuild some projects
| at work around this.
| at_compile_time wrote:
| Yup. Geometric algebra has one equation for each of:
| projection, rejection, join (e.g., two points into a line), and
| meet (e.g., two planes interacting at a line). The algebraic
| expression is the same regardless of the elements you're
| working with or the space you're working in.
|
| You get transformations too, as easy as M=b/a, where M can be
| applied to any element in the algebra by taking the square root
| and applying double-sided multiplication such that b = [?]M a
| ~[?]M, where tilde represents the reverse. These
| transformations are isomorphic to complex numbers, quaternions,
| and hypercomplex numbers, and understanding them makes other
| explanations of these concepts feel inadequate and woefully un-
| geometric.
|
| Add in logarithms and the exponential map for these
| transformations and we can perform linear interpolation between
| states and parametrize transformations.
|
| I'm just a motivated amateur and I can do all of these things.
| The vector algebra I learned in engineering is useful, and it's
| often all I need for simple 3-dimensional problems, but it's
| just shy of something far more powerful and far more general.
| dargscisyhp wrote:
| Great article, would love to know what you're using to create
| these diagrams!
| sleepingreset wrote:
| same!
| alexharri wrote:
| They're created with ThreeJS and react-three-fiber. My website
| is open source, you can find all of the 3D scenes here:
| https://github.com/alexharri/website/tree/master/src/threejs...
| danielvaughn wrote:
| Those graphics are beautiful.
| keithalewis wrote:
| https://en.m.wikipedia.org/wiki/Hermann_Grassmann would like to
| have a word with you.
| https://en.m.wikipedia.org/wiki/Giuseppe_Peano was so impressed
| he wrote a book to explain it. It is much easier to just read and
| try to understand what smarter people than us spent their
| precious time on earth figuring out. Newton was on to something
| about standing on shoulders of giants.An option available to
| anyone.
___________________________________________________________________
(page generated 2024-04-27 23:00 UTC)