Announcement

Collapse
No announcement yet.

Geometry Functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Thanks Baker,

    I wasn't really fishing for solutions - more like converting #2 into a real world 3d problem. For now I'm going to continue to attempt to solve this problem with just my brain (that's half the fun right?). However, if it gets to a point where my inability to solve the problem starts to slow the progress of project development - then I am definitely going to do what you suggested.

    Something tells me that somewhere among all the links you posted here lies the solution to my puzzle - I may just need to be exceptionally creative in order to see it. Luckily, I believe that I am

    Michael
    http://www.nextgenquake.com

    Comment


    • #32
      Things to not think about:



      If they could make that work in the real world, they might be able to make interesting robots that could flatten themselves.

      Or walking objects.
      Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

      So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

      Comment


      • #33
        Originally posted by Baker View Post
        Things to not think about:

        Tesseract, lol

        If they could make that work in the real world, they might be able to make interesting robots that could flatten themselves.

        Or walking objects.
        Donno about robots, but one of my teachers has constructed very special roof cover that flattens when it's hot and unpack when it's cold. No electronics, just metal with memory.
        Last edited by FC Zvyozdochka; 02-20-2012, 11:39 PM.

        Comment


        • #34
          If interested, do you know to solve some of the problems for this kind of scenario:



          1. x3, y3 = 36, 5 (line segment point C)
          2. x4, y4 = 106, 11 (line segment point D)
          3. x5, y5 = 70, 30 (circle center point E)
          4. radius R = 25

          Calculate points x1, y1 and points x2, y2 and sector angle and length of arc (stan? arctan? ugh ...)?

          I'm trying to wrap my head around this:

          http://mathworld.wolfram.com/Circle-...ersection.html
          http://mathworld.wolfram.com/SecantLine.html

          But even if I do, I'm still not sure how to get the angle even if I am able to solve x1, y1 and x2, y2

          Stuff I need to try:

          http://www.excellup.com/classten/mat...areaexone.aspx
          http://www.excellup.com/classten/mat...areaextwo.aspx
          http://www.excellup.com/classten/mat...eaexthree.aspx
          http://www.themathpage.com/atrig/line.htm
          Last edited by Baker; 02-21-2012, 12:10 PM.
          Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

          So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

          Comment


          • #35
            Actually, I'm going about this all around. Instead of using sine and cosine functions and not really understanding what they are doing, I need to learn how to calculate the sine and cosine without using the functions.

            A circle is merely an infinitely sided polygon and the point calculations are not some mysterious thing but linear algebra if the angle is converted to slope.



            http://mathworld.wolfram.com/Sine.html
            Last edited by Baker; 02-21-2012, 12:45 PM.
            Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

            So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

            Comment


            • #36
              Originally posted by FC Zvyozdochka View Post
              Now it is time to open parenthesis, but it is too boring, so I'm waiting while old Wolfram's Mathematica 5 is found on my another comp. It is very powerful and user-friendly program.

              Actually, the right solution is given in your link, Baker.
              The only need to do is to check whether intersection point(s) is inside or outside domain area. If it is outside - than line segment does not intersect circle. If both intersection points are outside domain area and distance δ is lesser than radius - then the whole segment is inside hat circle. Respectively, if δ>R - the whole segment is outside.

              Now when we have found all intersection points, it is time to find overlap area.
              The hardest thing is for me to determine the type of overlap (in numbers from post 13's pic). But this is possible when intersection point and lines' (or better vertexes') positions (inside/outside circle) are known. So lets think that we've found that type.
              The main problem now is to find areas of circle segments by 2 intersection points and radius.
              Obvious way is to throw lines from intersection points A and B to the center C, then to find sector's area and to subtract area of triangle ABC from it.
              But it is need to find angle between them. I only know how to find its cosine - cosα = (xAxB + yAyB)/((xA� + yA�)(xB� + yB�))^1/2.
              In this formula place of origin is the center of circle. So in general case xA goes to (xA-x0), yA goes to (yA-y0) and so on.
              α=arccos((xAxB + yAyB)/((xA� + yA�)(xB� + yB�))^1/2)

              Sector's area is 0.5*R^2*(α-sin(α))
              Triangle's ABC area could easily be calculated in matrix form as show in post #6.

              This solution should work good, but I don't like its bulkiness. I'll tell if I find more elegant one.
              This might be helpful.
              Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

              So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

              Comment


              • #37
                Originally posted by Baker View Post
                I need to learn how to calculate the sine and cosine without using the functions.


                Ok ... factorials and summations. I roughly get the idea of how it is calculated, which is enough. But I don't want to code that in C.

                Sine essentially calculates the rise (Y slope) of a triangle where hypotenuse (the side opposite the right angle) = radius, and angle CB is known where A is circle center.

                So slope m for angle Y can be calculated by Sine (angle) / Cosine (angle), as Sine is the length of the opposite and cosine is the length of the opposite if the slope is inverted (i.e. y/x --> x/y)
                Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                Comment


                • #38
                  I knew I would figure this out and i knew the answers were in this thread. Using your slope calculations (gist) based on the characters -

                  Code:
                  n = (newX-oldX) / (newZ-oldZ);
                  character.walk = allowedWalk(n);
                  oldX = newX;
                  oldZ = newZ;
                  
                  function allowedWalk(N)
                  {
                      if (N>1)                        //any angle less than 45
                          return true;
                      else
                          return false;
                  }
                  note: this example isn't supposed to be "QuakeC", or any specific language. It's just a quick representation based on simple programming basics. I may need to add an Math.abs(n) for walking down a slope, or maybe reverse the slope division order. It's not 100% tested but I know this is going to work.

                  Edit - I'll have to determine if X is actually or also a Y - regardless, using character world points to determine slope is the way to go
                  http://www.nextgenquake.com

                  Comment


                  • #39
                    I'm glad that helped you. I am rather rapidly rediscovering things I embarrassingly once knew but never kept in-use and very quickly learning things I never understood.

                    I never did take, for instance, trigonometry (but did more than a fair share of calculus and statistics) and I've been working out circle and triangle equations and re-familiarizing myself with terminology.

                    In retrospect, I wish they would have spent 5% of time explaining exciting uses for these topics as they taught them.

                    I think math dissipating after the need to know it for college exams is over and such is rather common.
                    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                    Comment


                    • #40
                      Just about have circle trigonometry mastered. Not so hard after a while.

                      But initially getting your head into them is a bit challenging, or at least it was for me ...

                      And then it all snaps into place.
                      Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                      So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                      Comment


                      • #41
                        Can't you please wait for a couple of days? We've got a Defender of the Fatherland Day here
                        I'll post here that my solution with all parentheses disclosed and in well readable form.

                        Maybe I'll find simplier solution, but actually I never have seen any curved lines solutions in pure matrix form (which is more convenient for you) without trigonometry.
                        But as you've already seen - trigonometry is pretty simple thing.
                        Are sinus and cosines defined in your development environment? Or you need to declare it as functions of angle?

                        Comment


                        • #42
                          There is no hurry at all.


                          Originally posted by FC Zvyozdochka View Post
                          Are sines and cosines defined in your development environment? Or you need to declare it as functions of angle?
                          Those are defined. I was briefly considering self-calculating just so I see what those functions really do.
                          Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                          So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                          Comment


                          • #43
                            hah - all the answers I needed were in your very first post. I didn't actually find all the answers that easily (unfortunately) but sure enough they were right there.

                            Code:
                            altDistance = newZ-oldZ;
                            latLonDistance = Math.sqrt( Math.pow(newX-oldX,2) + Math.pow(newY-oldY,2) );
                            slope = altDistance/latLonDistance;
                            WooHoo! no more clip brushes and building maps in 3 different parts (ground/walls/clips). Yet, I still keep the functionality of accurately moving across uneven terrain.

                            perfectness,
                            Michael
                            Last edited by MadGypsy; 02-22-2012, 01:59 PM.
                            http://www.nextgenquake.com

                            Comment


                            • #44
                              Want to get into playing Quake again? Click here for the Multiplayer-Startup kit! laissez bon temps rouler!

                              Comment


                              • #45
                                While some rage quit, others just rage ahead ...

                                Code:
                                float Circle_Arc_Length_From_Chord_Length_And_Degrees (const float chordlength, const float degrees);
                                float Circle_Arc_Length_From_Radius_And_Degrees (const float radius, const float degrees);
                                float Circle_Arc_Length_From_Radius_And_Radians (const float radius, const float radians);
                                float Circle_Area_From_Circumference (const float circumference);
                                float Circle_Area_From_Diameter (const float diameter);
                                float Circle_Area_From_Radius (const float radius);
                                float Circle_Chord_Length_From_Radius_And_Degrees (const float radius, const float degrees);
                                float Circle_Chord_Length_From_Radius_And_Radians (const float radius, const float radians);
                                float Circle_Circumference_From_Arc_Length_And_Degrees (const float arclength, const float degrees);
                                float Circle_Circumference_From_Arc_Length_And_Radians (const float arclength, const float radians);
                                float Circle_Circumference_From_Area (const float area);
                                float Circle_Circumference_From_Diameter (const float diameter);
                                float Circle_Circumference_From_Radius (const float radius);
                                float Circle_Diameter_From_Area (const float area);
                                float Circle_Minor_Segment_Area_From_Degrees_And_Radius (const float degrees, const float radius);
                                float Circle_Minor_Segment_Area_From_Radians_And_Radius (const float radians, const float radius);
                                float Circle_Radius_From_Arc_Length_And_Degrees (const float arclength, const float degrees);
                                float Circle_Radius_From_Arc_Length_And_Radians (const float arclength, const float radians);
                                float Circle_Radius_From_Area (const float area);
                                float Circle_Radius_From_Chord_Length_And_Degrees (const float chordlength, const float degrees);
                                float Circle_Radius_From_Chord_Length_And_Radians (const float chordlength, const float radians);
                                float Circle_Radius_From_Chord_Length_And_Radians (const float chordlength, const float radians);
                                float Circle_Radius_From_Circumference (const float circumference);
                                float Circle_Sector_Area_From_Degrees_And_Radius (const float degrees, const float radius);
                                float Circle_Sector_Percent_From_Degrees (const float degrees);
                                float Circle_Sector_Percent_From_Radians (const float radians);
                                float Circle_Theta_In_Degrees_From_Arc_Length_And_Radius (const float arclength, const float radius);
                                float Circle_Theta_In_Degrees_From_X_Y_Relative_To_Center_And_Radius (const float x, const float y, const float radius);
                                float Circle_Theta_In_Radians_From_Arc_Length_And_Radius (const float arclength, const float radius);
                                float Circle_Theta_In_Radians_From_X_Y_Relative_To_Center_And_Radius (const float x, const float y, const float radius);
                                float Line_Segment_Length_From_Points (const float x1, const float y1, const float x2, const float y2);
                                float Line_Segment_Length_From_Rise_Run (const float rise, const float run);
                                float Quadrilateral_Perimeter_From_Side_Lengths (const float length1, const float length2, const float length3, const float length4);
                                float Rectangle_Area_From_Width_Height	(const float width, const float height);
                                float Rectangle_Diagonal_Length_From_Width_Height (const float width, const float height);
                                float Rectangle_Perimeter_From_Width_Height (const float width, const float height);
                                float Regular_Polygon_Area_From_Number_Of_Sides_And_CircumRadius (const float numberSides, const float circumRadius);
                                float Regular_Polygon_Area_From_Number_Of_Sides_And_InRadius (const float numberSides, const float inRadius);
                                float Regular_Polygon_Area_From_Number_Of_Sides_And_InRadius_And_SideLength (const float numberSides, const float inRadius, const float sideLength);
                                float Regular_Polygon_Area_From_Number_Of_Sides_And_Length (const float numberSides, const float sidelength);
                                float Regular_Polygon_Area_From_Number_Of_Sides_And_Perimeter (const float numberSides, const float periMeter);
                                float Triangle_Area_From_Points (const float Ax, const float Ay, const float Bx, const float By, const float Cx, const float Cy);
                                float Triangle_Area_From_Three_Lengths (const float length1, const float length2, const float length3);
                                float Triangle_Area_From_Width_Height (const float width, const float height);
                                float Triangle_Isosceles_Triangle_Third_Angle_From_Mirrored_Angle (const float angle);
                                float Triangle_Length_From_Two_Sides_And_BetweenAngle (const float length1, const float length2, const float betweenAngle);
                                float Triangle_Right_Triangle_Third_Angle_From_One_Angle (const float angle);
                                float Triangle_Third_Angle_From_Two_Angles (const float angle1, const float angle2);
                                One week ago, I would have done anything to have nothing to do with some of this kind of math.
                                Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                                So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                                Comment

                                Working...
                                X