It is currently Fri Jul 19, 2019 4:52 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Thu Mar 10, 2011 12:25 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Code:
Procedure.f Rad2degree(Rad.f) 
  myRad.f = (180 * Rad) / #PI
  ProcedureReturn myRad
EndProcedure


Code:
;purpose: To calculate the angle between 2 objects in 2D space
;input:    P1 - the location of the first object
;          P2 - the location of the second object
; output: the angle between the objects in degrees
Procedure.f calculateAngle2D(*P1.POINT, *P2.POINT, rad.d)
    Protected  ang.f = 0.0, calc.f = 0.0
    calc = (*P2\y - *P1\y)/ (*P2\x - *P1\x)    ;<--- Error in calculation spottet by Demivec. (Fixed).
    ang = ATan(calc) * radtodeg(rad)
    ;In the event that the angle is in the first quadrant
    If *P2\y < *P1\y And *P2\x > *P1\x
      ProcedureReturn ang
    ElseIf (*P2\y < *P1\y And *P2\x < *P1\x) Or (*P2\y > *P1\y And *P2\x < *P1\x)
    ;In the event of second Or third quadrant
       ProcedureReturn ang + 180
    Else
    ;If none of the above, it must be in the fourth
       ProcedureReturn ang + 360
    EndIf
EndProcedure

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Last edited by DK_PETER on Wed Mar 16, 2011 2:07 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Thu Mar 10, 2011 12:28 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Code:
Structure _3Dvector
  x.f
  y.f
  z.f
EndStructure

;purpose: To calculate the weight of an object based on its mass
;input:   mass - the mass of the object
;         grav - the amount of constant acceleration due To gravity
;output:  an structure with 3 floats representing the vector of weight
Procedure calcWeight3D(*obj._3Dvector, mass.f, grav.f)
    ;The value in y will be the only number changed, since gravity
    ;is only applied along the Y axis
    ;Calculate the weight, it is assumed that grav(ity) is a negative number
    *obj\y = mass * grav
    ProcedureReturn @Obj
EndProcedure


_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Thu Mar 10, 2011 12:29 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Code:
;Purpose: To find the momentum of object with a given mass,travelling at a certain velocity
Procedure.f momentum(velocity.f, mass.f)
  Protected momentum.f
  momentum = mass*velocity
  ProcedureReturn momentum
EndProcedure

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Thu Mar 10, 2011 4:02 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1205
Location: Germany, Glienicke
Note:

You don't need your procedures Degree2Rad() and Rad2degree(), PB has Radian() and Degree()

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Fri Mar 11, 2011 12:51 am 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 932
Location: United States
Scale speed based on FPS:
Code:
speed*(60/fps))

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Fri Mar 11, 2011 8:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Code:
;Pass velocity And time and return resulting displacement.
Procedure.f calcDisplacement(velocity.f, _time.f)
      ProcedureReturn velocity * _time
EndProcedure

;Pass the old position , velocity And time and return new position specified by time.
Procedure.f calcPosition(oldPosition.f, velocity.f, _time.f)
      ProcedureReturn oldPosition + (velocity * _time)
EndProcedure

Procedure.f calcAvgerageVelocity(_start.f , _End.f, time.f)
      ProcedureReturn (_End - _start)/ time
EndProcedure

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Wed Mar 16, 2011 2:26 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Might be usefull to someone :)
Code:
;Ohms law procedure
Procedure.f Ohm_Law(value1.f, value2.f, CalcType.i = 0)
  Protected result.f
  Select CalcType
    Case 0     ;Voltage    -     value1 = current : value2 = resistance
      result = value1 * value2
    Case 1     ;Current    -     value1 = voltage : value2 = resistance
      result = value1 / value2
    Case 2     ;Resistance -     value1 = voltage : value2 = current
      result = value1 / value2
  EndSelect
  ProcedureReturn result
EndProcedure

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Wed Mar 16, 2011 2:56 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 3559
Location: Utah, USA
To calculate the angle of an object from an arbitrary point (origin) in 2D space
Code:
;purpose: To calculate the angle of an object from an arbitrary point (origin) in 2D space
;input:    origin - the location of the origin
;          P1 - the location of the object
;output: the angle from the origin to the object in degrees
Procedure.f calculateRelativeAngle2D(*origin.POINT, *P1.POINT)
  Protected  ang.f, calc.f
  calc = (*P1\y - *origin\y) / (*P1\x - *origin\x)
  ang = Degree(ATan(calc))

  If *P1\y < *origin\y And *P1\x > *origin\x
    ProcedureReturn ang  ;angle is in the first quadrant
  ElseIf (*P1\y < *origin\y And *P1\x < *origin\x) Or (*P1\y > *origin\y And *P1\x < *origin\x)
    ProcedureReturn ang + 180 ;angle is in the second Or third quadrant
  Else
    ProcedureReturn ang + 360 ;angle is in the fourth quadrant
  EndIf
EndProcedure


I would've posted an option to return the results in radians but fumbled on my first few attempts to do so, maybe in the near future I'll update the code when I have a second to work out what needs to be done.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Sun Mar 20, 2011 2:05 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3379
Location: New Zealand
first 3 moments of inertia for 2D particle physics, image analysis or a case where you need information on an object that that you haven't explicitly constructed.

Code:
;first 3 moments of inertia 2D
;   
;   1st moment, center of a mass

;   where
;       sumx + x
;       sum y + y
;   
;    cx = sumx / area
;    cy = sumy / area
;
;   2nd moment, inertia of mass around axis       

;   where
;       sumXX  +  (X*X)
;       sumYY  +  (Y*Y)   
;       sumXY  +  (X*Y)
;   
;   IX = SumXX - (Area * (cx * cx))
;   IY = SumYY - (Area * (cy * cy))
;   IXY = Sumxy - (Area * (cx * cy))
;
;   3rd moments, ra,rb, rc or shape parameter
;   *note the shape parameter is invariant to both scale and rotation for a given identical mass 
;    and can be used to identify shapes in some cases.
 
;   ta= Sqr((2.0 * ix * iY) - (4.0 *( ixy * ixy))/2.0)
;   Ra = (ix + iy) + ta
;   Rb = (ix + iy) - ta
;   Shape = (Ra / Rb)
;
;   orientation of mass   
;   
;       where
;         mmx  = Xmax - Xmin
;         mmy = Ymax - Ymin         
;
;     If ix = iy
;             orient = 45       
;     ElseIf mmx >= mmy     
;             orient = (0.5 * (ATan(2 * (Ixy / (Iy - ix))))) / (#PI / 180)
;     Else
;           orient = (0.5 * (ATan(2 * Ixy / (ix - Iy)))) / (#PI / 180)
;     EndIf

;example below

Structure moments
    ;moments
   ;1st 
    cx.f
    cy.f
    ;2nd
    ix.f
    iy.f
    ixy.f
    ;3rd
    ra.f
    rb.f
    shape.f
    ;orientation
    orient.f 
    ;elipse
    majoraxis.f
    minoraxis.f
    ;bounds
    Xmin.i
    Xmax.i
    Ymin.i
    Ymax.i
 EndStructure
 
Procedure GetMoments(img,x1,x2,y1,y2,color,*mom.moments)
  Protected x,y,px,area.f,sumX.f,sumY.f,sumXX.f,sumYY.f,sumXY.f
  Protected ta.f,mmx.f,mmy.f,cmx.f,cmy.f,orient.f
 
  *mom\Xmin = 99999
  *mom\Ymin = 99999
 
 If StartDrawing(ImageOutput(img))
 
   For x = x1 To x2
       For y = y1 To y2
     
        px = Point(x,y) 
     
         If px = color
           
              sumX + x 
              sumY + y 
              Area + 1   
              sumXX + (x*x)
              sumYY + (y*y) 
              sumXY + (x*y) 
                               
              If x < *mom\Xmin 
                 *mom\Xmin = x
              EndIf
               
              If x > *mom\XMax
                   *mom\Xmax = x
              EndIf
               
              If y < *mom\Ymin 
                 *mom\Ymin = y
              EndIf
               
              If y > *mom\Ymax
                 *mom\Ymax = y
              EndIf
            EndIf
          Next
     Next     
     
     StopDrawing()
     
     ;1st moments cx = centerX cy=centerY
     *mom\cx = sumx / Area
     *mom\cy = sumy / Area
 
     
     ;2nd moments Ix Iy Ixy 
     *mom\ix = SumXX - (Area * (cx * cx))
     *mom\iY = SumYY - (Area * (cy * cy))
     *mom\ixY = Sumxy - (Area * (cx * cy))
                   
     ;3rd moment shape parameter invarent to scale and rotation
     ta= Sqr((2.0 * *mom\ix * *mom\iY) - (4.0 *(*mom\ixy * *mom\ixy)) * 0.5)
           
     *mom\Ra = (*mom\ix + *mom\iy) + ta
     *mom\Rb = (*mom\ix + *mom\iy) - ta
     
     *mom\Shape = (*mom\Ra / *mom\Rb)
       
     mmx = (*mom\Xmax - *mom\Xmin)
     mmy = (*mom\Ymax - *mom\Ymin)
     cmx = (*mom\Xmax + *mom\Xmin) * 0.5
     cmy = (*mom\Ymax + *mom\Ymin) * 0.5
     dmx = *mom\cx - cmx
     dmy = *mom\cy - cmy
                   
     ;orientation       
      If *mom\ix = *mom\iy
             orient = 45       
      ElseIf mmx >= mmy
             orient = (0.5 * (ATan(2 * (*mom\Ixy / (*mom\iy - *mom\ix))))) / (#PI / 180)
             *mom\majoraxis = (mmx / Cos(Abs(orient) / (180 / #PI))) * 0.5
             *mom\minoraxis = (Area) / (#PI * *mom\majoraxis)
      Else
             orient = (0.5 * (ATan(2 * *mom\Ixy / (*mom\ix - *mom\Iy)))) / (#PI / 180)
             *mom\majoraxis = (mmy / Cos(Abs(orient) / (180 / #PI))) * 0.5
             *mom\minoraxis = (Area) / (#PI * *mom\majoraxis)
      EndIf
         
      If mmx = mmy  And Abs(*mom\ix- *mom\iy) < 1000
             orient = 0
      EndIf
     
      ;messy fudge to output  0 to 360 degrees
      If *mom\ixy > 0
           If *mom\iy > *mom\ix
                If dmx > dmy
                   orient = (360 + orient) / (180/#PI)
                Else
                   orient = (180 + orient) / (180/#PI)
                EndIf
             Else
                If dmx > dmy
                  orient = (90 - orient) / (180/#PI)
                Else
                  orient = (270 - orient) / (180/#PI)
                EndIf 
             EndIf
          Else
             If *mom\iy > *mom\ix
                If dmy > dmx
                  orient = (180 + orient) / (180/#PI)
                Else
                  orient = orient / (180/#PI)
                EndIf   
             Else
                If dmx > dmy
                  orient = (90 - orient) / (180/#PI)
                Else
                  orient = (270 - orient) / (180/#PI)
                EndIf   
             EndIf
        EndIf   
                   
      If orient < 0
            orient = 0
      EndIf     
     
      *mom\orient = orient
     
   EndIf   
         
 EndProcedure   



Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Mon Apr 25, 2011 11:49 pm 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 932
Location: United States
Fractional Part function:
Code:
Procedure.f Frac(a.f)
   result.f = a.f - Round(a.f,#PB_Round_Down)
   ProcedureReturn result.f
EndProcedure

Debug frac(2003.5)

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Fri Aug 05, 2011 2:43 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Oct 22, 2003 2:51 am
Posts: 743
Location: Canada
Hello everyone,

If you search for a General Maths Matrix calculation have a look here : http://www.purebasic.fr/english/viewtopic.php?f=12&t=47084&p=357864#p357864

Best regards.
Guimauve


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Wed Jan 11, 2012 6:40 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5819
Location: Wales, UK
Some interesting Physics for a car game: http://www.purebasic.fr/english/viewtopic.php?t=25481

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Sat May 28, 2016 3:02 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jul 07, 2013 11:35 am
Posts: 400
Location: Canada
Hello everyone,

This is my Gaming Maths Library, featuring Vector2, Vector3, Vector4, Quaternion, Matrix22, Matrix33 and Matrix44. (Everything is coded into modules)
It also contain a Quaternion VS Matrix44 transformation demo.

https://www.dropbox.com/s/ei1cckqn22r9brh/Gaming_Maths_Library.zip?dl=0

Best regards
StarBootics

_________________
The Stone Age did not end due to a shortage of stones !


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Fri Jun 03, 2016 2:04 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jul 07, 2013 11:35 am
Posts: 400
Location: Canada
Hello everyone,

Another module, Plane in 3D. Please note this module require Vector3 module available in the zip here

Best regards
StarBootics
Code:
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Plane - Module
; File Name : Plane - Module.pb
; File version: 1.0.0
; Programming : OK
; Programmed by : StarBootics
; Date : 09-03-2015
; Last Update : 02-06-2016
; PureBasic code : V5.42 LTS
; Platform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;
; This code is free to be use where ever you like
; but you use it at your own risk.
;
; The author can in no way be held responsible
; for data loss, damage or other annoying
; situations that may occur.
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

CompilerIf #PB_Compiler_IsMainFile
 
  IncludeFile "Vector3 - Module.pb"
 
CompilerEndIf

DeclareModule Plane
 
  Structure Plane
   
    A.f
    B.f
    C.f
    D.f
   
  EndStructure
 
  Declare Update(*PlaneA.Plane, P_A.f, P_B.f, P_C.f, P_D.f)
  Declare Reset(*PlaneA.Plane)
  Declare ReadPlane(FileID.l, *PlaneA.Plane)
  Declare WritePlane(FileID.l, *PlaneA.Plane)
  Declare.s Format(*PlaneA.Plane, Decimal.b = 3)
  Declare UnFormat(*PlaneA.Plane, Formated.s)
 
  CompilerIf Defined(Vector3, #PB_Module)
    Declare.f Distance(*PlaneA.Plane, *VectorA.Vector3::Vector3)
    Declare.f Evaluate(*PlaneA.Plane, *VectorA.Vector3::Vector3)
    Declare FromPoints(*PlaneA.Plane, *VectorA.Vector3::Vector3, *VectorB.Vector3::Vector3, *VectorC.Vector3::Vector3)
    Declare IsPointInside(*PlaneA.Plane, *VectorA.Vector3::Vector3)
  CompilerEndIf
 
EndDeclareModule

Module Plane
 
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur Update <<<<<
 
  Procedure Update(*PlaneA.Plane, P_A.f, P_B.f, P_C.f, P_D.f)
   
    *PlaneA\A = P_A
    *PlaneA\B = P_B
    *PlaneA\C = P_C
    *PlaneA\D = P_D
   
  EndProcedure
 
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur Reset <<<<<

  Procedure Reset(*PlaneA.Plane)
   
    *PlaneA\A = 0.0
    *PlaneA\B = 0.0
    *PlaneA\C = 0.0
    *PlaneA\D = 0.0
   
  EndProcedure

  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Lecture sur fichier Binaire <<<<<

  Procedure ReadPlane(FileID.l, *PlaneA.Plane)
   
    *PlaneA\A = ReadFloat(FileID)
    *PlaneA\B = ReadFloat(FileID)
    *PlaneA\C = ReadFloat(FileID)
    *PlaneA\D = ReadFloat(FileID)
   
  EndProcedure

  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Écriture sur fichier Binaire <<<<<

  Procedure WritePlane(FileID.l, *PlaneA.Plane)
   
    WriteFloat(FileID, *PlaneA\A)
    WriteFloat(FileID, *PlaneA\B)
    WriteFloat(FileID, *PlaneA\C)
    WriteFloat(FileID, *PlaneA\D)
   
  EndProcedure
 
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Formatage de l'équation du plan <<<<<
 
  Procedure.s Format(*PlaneA.Plane, Decimal.b = 3)
   
    ProcedureReturn StrF(*PlaneA\A, Decimal) + "x + " + StrF(*PlaneA\B, Decimal) + "y + " + StrF(*PlaneA\C, Decimal) + "z = " + StrD(*PlaneA\D, Decimal)
  EndProcedure
 
  Procedure UnFormat(*PlaneA.Plane, Formated.s)
   
    *PlaneA\A = ValF(StringField(Trim(StringField(Formated, 1, "+")), 1, "x"))
    *PlaneA\B = ValF(StringField(Trim(StringField(Formated, 2, "+")), 1, "y"))
    *PlaneA\C = ValF(StringField(Trim(StringField(StringField(Formated, 1, "="), 3, "+")), 1, "z"))
    *PlaneA\D = ValF(Trim(StringField(Formated, 2, "=")))
   
  EndProcedure

  CompilerIf Defined(Vector3, #PB_Module)
   
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; <<<<< Distance Point plan <<<<<
 
    Procedure.f Distance(*PlaneA.Plane, *VectorA.Vector3::Vector3)
   
      ProcedureReturn (*PlaneA\A * *VectorA\i + *PlaneA\B * *VectorA\j + *PlaneA\C * *VectorA\k + *PlaneA\D) / Sqr(*PlaneA\A * *PlaneA\A + *PlaneA\B * *PlaneA\B + *PlaneA\C * *PlaneA\C)
    EndProcedure
 
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; <<<<< Évaluation du plan au point spécifié <<<<<
 
    Procedure.f Evaluate(*PlaneA.Plane, *VectorA.Vector3::Vector3)
   
      ProcedureReturn *PlaneA\A * *VectorA\i + *PlaneA\B * *VectorA\j + *PlaneA\C * *VectorA\k
    EndProcedure
 
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; <<<<< Un plan passant par 3 points <<<<<
 
    Procedure FromPoints(*PlaneA.Plane, *VectorA.Vector3::Vector3, *VectorB.Vector3::Vector3, *VectorC.Vector3::Vector3)
   
      Vector3::Minus(Alpha.Vector3::Vector3, *VectorB, *VectorA)
      Vector3::Minus(Beta.Vector3::Vector3, *VectorC, *VectorA)
      Vector3::CrossProduct(Normal.Vector3::Vector3, Alpha, Beta)
      Vector3::Unit(Normal)
      CopyMemory(Normal, *PlaneA, SizeOf(Vector3::Vector3))
      *PlaneA\D = *PlaneA\A * *VectorA\i + *PlaneA\B * *VectorA\j + *PlaneA\C * *VectorA\k
   
    EndProcedure
 
    Procedure IsPointInside(*PlaneA.Plane, *VectorA.Vector3::Vector3)
   
      If *PlaneA\A * *VectorA\i + *PlaneA\B * *VectorA\j + *PlaneA\C * *VectorA\k = *PlaneA\D
        Result = #True
      Else
        Result = #False
      EndIf
   
      ProcedureReturn Result
    EndProcedure

  CompilerEndIf

EndModule

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code généré en : 00.001 secondes (75000.00 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

CompilerIf #PB_Compiler_IsMainFile

  Vector3::Update(P.Vector3::Vector3, 0.0, 0.0, 1.0)
  Vector3::Update(Q.Vector3::Vector3, 4.0, 2.0, 3.0)
  Vector3::Update(R.Vector3::Vector3, -3.0, 1.0, 1.0)
 
  Vector3::Update(S.Vector3::Vector3, -9.0, -10.0, -25.0)
  Vector3::Update(T.Vector3::Vector3, 9.0, 10.0, 25.0)
 
  Plane::FromPoints(Plane.Plane::Plane, P, Q, R)
 
  Debug Plane::Format(Plane)
  Debug Plane::Evaluate(Plane, P)
  Debug Plane::Evaluate(Plane, Q)
  Debug Plane::Evaluate(Plane, R)
 
  Debug ""
 
  Debug Plane::IsPointInside(Plane, S)
  Debug Plane::IsPointInside(Plane, T)
 
  Debug ""
 
  Debug Plane::Distance(Plane, S)
  Debug Plane::Distance(Plane, T)

CompilerEndIf

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<

_________________
The Stone Age did not end due to a shortage of stones !


Top
 Profile  
Reply with quote  
 Post subject: Re: Game Math (Post all your snippits and guides here). Than
PostPosted: Thu Jun 09, 2016 11:38 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5819
Location: Wales, UK
....nice one StarBootics, thanks for sharing. I'm surprised to see read/write file Procedures that do not need to Open/Create/Close the file.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye