Ball Physics

Warning! Some information on this page is older than 3 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

19:58
Sat
17
Mar 2012

Ball Physics

Checking collision between different kinds of 2D or 3D shapes is a subject I deal with for some time. It is useful in game development to determine if some object is visible or affected by light and this if it should be rendered. I have lots of function to check such collisions in the math module of CommonLib library.

But that is only the beginning if you want to make physics. Adding physical behavior to your game requires additional calculations to correct positions and apply forces to colliding bodies. I prepared a small code snippet that implements physical 2D collision between moving circle and another moving circle (calculated by CircleToCircleCollision function), static line (CircleToLineCollision function) and static axis-aligned rectangle (CircleToRectangleCollision function).

Download: ball_physics.cpp

The code uses some good practices (like fixed time step) as well as bad practices (like Euler integration). It should be enough for a simple physics in game like a platformer.

Comments (2) | Tags: math physics | Author: Adam Sawicki | Share

Comments

狼一号
2015-04-13 09:32:08
中国国内では威哥王と並ぶ狼1号,狼一号大人気の商品です。最近、雑誌SPAにも掲載された勃起促進薬です。

狼一号:http://www.xn--4gq48lvu4a.com/
http://www.中絶薬.com/
http://www.威哥王通販.com/
http://www.巨人倍増.net/
http://www.狼一号.com/
http://www.花痴.net/
http://www.紅蜘蛛通販.net/
http://www.妖姫.net/
http://www.妖姫.com/
http://www.中絶薬.com/
http://www.女性用媚薬.com/
http://www.曲美通販.com
http://www.三便宝.net/
http://www.xn--4gq48lvu4a.com/
http://www.chinakanpo.com/product/wubianbao.html
http://www.chinakanpo.com/product/hzhzyd.html
http://www.chinakanpo.com/product/huachi.html
http://www.chinakanpo.com/product/rush566.html
http://www.chinakanpo.com/catalog/16.html
http://www.chinakanpo.com/catalog/25.html
http://www.chinakanpo.com/catalog/60.html
ewqt
2015-04-14 11:08:51
<a href="http://www.chanelhandbags.net.co/"><b>chanel handbags</b></a>, http://www.chanelhandbags.net.co/<br>
<a href="http://www.chiflatiron.net.co/"><b>flat iron</b></a>, http://www.chiflatiron.net.co/<br>
<a href="http://www.converse.net.co/"><b>converse</b></a>, http://www.converse.net.co/<br>
<a href="http://www.ferragamo.com.co/"><b>salvatore ferragamo</b></a>, http://www.ferragamo.com.co/<br>
<a href="http://www.guccihandbags.com.co/"><b>gucci shoes</b></a>, http://www.guccihandbags.com.co/<br>
<a href="http://www.hollister.us.org/"><b>hollister clothing</b></a>, http://www.hollister.us.org/<br>
<a href="http://www.insanityworkout.net.co/"><b>insanity workout</b></a>, http://www.insanityworkout.net.co/<br>
<a href="http://www.jimmychoo.net.co/"><b>jimmy choo</b></a>, http://www.jimmychoo.net.co/<br>
<a href="http://www.jordan-shoes.com.co/"><b>jordan retro</b></a>, http://www.jordan-shoes.com.co/<br>
<a href="http://www.juicycouture.com.co/"><b>juicy couture outlet</b></a>, http://www.juicycouture.com.co/<br>
<a href="http://www.juicycoutureoutlet.net.co/"><b>juicy couture handbags</b></a>, http://www.juicycoutureoutlet.net.co/<br>
<a href="http://www.kate-spade.com.co/"><b>kate spade handbags</b></a>, http://www.kate-spade.com.co/<br>
<a href="http://www.katespade-outlet.com.co/"><b>kate spade</b></a>, http://www.katespade-outlet.com.co/<br>
<a href="http://www.louisvuitton-outlet.com.co/"><b>louis vuitton outlet online</b></a>, http://www.louisvuitton-outlet.com.co/<br>
<a href="http://www.michael-kors.us.org/"><b>michael kors</b></a>, http://www.michael-kors.us.org/<br>
<a href="http://www.michael-kors-handbags.us.com/"><b>michael kors outlet online</b></a>, http://www.michael-kors-handbags.us.com/<br>
<a href="http://www.michael-kors-outlet.us.org/"><b>michael kors purses</b></a>, http://www.michael-kors-outlet.us.org/<br>
<a href="http://www.michael-kors-outlet-online.us.org/"><b>michael kors outlet online sale</b></a>, http://www.michael-kors-outlet-online.us.org/<br>
<a href="http://www.michaelkorsoutletonline-sale.us.com/"><b>michael kors outlet store</b></a>, http://www.michaelkorsoutletonline-sale.us.com/<br>
<a href="http://www.northface.us.org/"><b>north face backpacks</b></a>, http://www.northface.us.org/<br>
<a href="http://www.oakley-sunglasses.us.org/"><b>oakley sunglasses</b></a>, http://www.oakley-sunglasses.us.org/<br>
<a href="http://www.pandorajewelry.com.co/"><b>pandora jewelry</b></a>, http://www.pandorajewelry.com.co/<br>
<a href="http://www.pradahandbags.com.co/"><b>prada handbags</b></a>, http://www.pradahandbags.com.co/<br>
<a href="http://www.pradashoes.com.co/"><b>prada outlet</b></a>, http://www.pradashoes.com.co/<br>
<a href="http://www.ray-ban-outlet.us.com/"><b>ray ban outlet</b></a>, http://www.ray-ban-outlet.us.com/<br>
<a href="http://www.rayban-sunglasses.us.org/"><b>ray-ban sunglasses</b></a>, http://www.rayban-sunglasses.us.org/<br>
<a href="http://www.replicawatches.us.com/"><b>rolex watches for sale</b></a>, http://www.replicawatches.us.com/<br>
<a href="http://www.swarovskicrystal.com.co/"><b>swarovski crystal</b></a>, http://www.swarovskicrystal.com.co/<br>
<a href="http://www.thenorthface.us.org/"><b>north face outlet</b></a>, http://www.thenorthface.us.org/<br>
<a href="http://www.tiffanyandco.net.co/"><b>tiffany and co</b></a>, http://www.tiffanyandco.net.co/<br>
<a href="http://www.tiffanyjewelry.us.org/"><b>tiffany jewelry</b></a>, http://www.tiffanyjewelry.us.org/<br>
<a href="http://www.true-religion.com.co/"><b>true religion jeans</b></a>, http://www.true-religion.com.co/<br>
<a href="http://www.truereligionjeans.net.co/"><b>true religion</b></a>, http://www.truereligionjeans.net.co/<br>
<a href="http://www.uggaustralia.net.co/"><b>ugg</b></a>, http://www.uggaustralia.net.co/<br>
<a href="http://www.uggboots.net.co/"><b>ugg australia</b></a>, http://www.uggboots.net.co/<br>
<a href="http://www.uggbootsclearance.com.co/"><b>uggs</b></a>, http://www.uggbootsclearance.com.co/<br>
<a href="http://www.uggsonsale.com.co/"><b>ugg boots clearance</b></a>, http://www.uggsonsale.com.co/<br>
<a href="http://www.uggsoutlet.com.co/"><b>uggs on sale</b></a>, http://www.uggsoutlet.com.co/<br>
<a href="http://www.cheap-oakleysunglasses.in.net/"><b>oakley vault</b></a>, http://www.cheap-oakleysunglasses.in.net/<br>
<a href="http://www.oakleysunglassescheap.in.net/"><b>oakley outlet</b></a>, http://www.oakleysunglassescheap.in.net/<br>
<a href="http://www.ralphlaurenoutletonline.in.net/"><b>ralph lauren outlet</b></a>, http://www.ralphlaurenoutletonline.in.net/<br>
<a href="http://www.ralphlauren--outlet.in.net/"><b>polo ralph lauren outlet</b></a>, http://www.ralphlauren--outlet.in.net/<br>
<a href="http://www.burberryoutlet--online.in.net/"><b>burberry handbags</b></a>, http://www.burberryoutlet--online.in.net/<br>
<a href="http://www.tomshoes.in.net/"><b>tom's shoes</b></a>, http://www.tomshoes.in.net/<br>
<a href="http://www.toms-outlet.in.net/"><b>toms shoes outlet</b></a>, http://www.toms-outlet.in.net/<br>
<a href="http://www.christianlouboutin.in.net/"><b>christian louboutin</b></a>, http://www.christianlouboutin.in.net/<br>
<a href="http://www.tory-burch-outlet.in.net/"><b>tory burch shoes</b></a>, http://www.tory-burch-outlet.in.net/<br>
<a href="http://www.gucci-outlet.in.net/"><b>gucci shoes</b></a>, http://www.gucci-outlet.in.net/<br>
<a href="http://www.longchamphandbagsoutlet.in.net/"><b>long champ</b></a>, http://www.longchamphandbagsoutlet.in.net/<br>
<a href="http://www.abercrombie-kids.in.net/"><b>abercrombie fitch</b></a>, http://www.abercrombie-kids.in.net/<br>
<a href="http://www.hollisterclothing-store.in.net/"><b>hollisterco</b></a>, http://www.hollisterclothing-store.in.net/<br>
<a href="http://www.hermes.in.net/"><b>hermes bags</b></a>, http://www.hermes.in.net/<br>
<a href="http://www.cheapjerseys.in.net/"><b>nba jerseys</b></a>, http://www.cheapjerseys.in.net/<br>
<a href="http://www.beats-by-dre.in.net/"><b>beats by dr dre</b></a>, http://www.beats-by-dre.in.net/<br>
<a href="http://www.beatsheadphones.in.net/"><b>beats audio</b></a>, http://www.beatsheadphones.in.net/<br>
<a href="http://www.ghdhairstraightener.in.net/"><b>straighteners</b></a>, http://www.ghdhairstraightener.in.net/<br>
<a href="http://www.rayban-sunglasses.org.uk/"><b>ray bans</b></a>, http://www.rayban-sunglasses.org.uk/<br>
<a href="http://www.michaelkors-uk.org.uk/"><b>michael kors outlet</b></a>, http://www.michaelkors-uk.org.uk/<br>
<a href="http://www.michaelkorshandbags.org.uk/"><b>michael kors bags</b></a>, http://www.michaelkorshandbags.org.uk/<br>
<a href="http://www.louis--vuitton.org.uk/"><b>louis vuitton uk</b></a>, http://www.louis--vuitton.org.uk/<br>
<a href="http://www.ralphlauren-outlet.org.uk/"><b>ralph lauren uk</b></a>, http://www.ralphlauren-outlet.org.uk/<br>
<a href="http://www.nikefree-run.org.uk/"><b>nike free run</b></a>, http://www.nikefree-run.org.uk/<br>
<a href="http://www.rolex-watches.me.uk/"><b>replica watches</b></a>, http://www.rolex-watches.me.uk/<br>
<a href="http://www.weddingdressesuk.org.uk/"><b>wedding dress</b></a>, http://www.weddingdressesuk.org.uk/<br>
<a href="http://www.pandora-charms.org.uk/"><b>pandora rings</b></a>, http://www.pandora-charms.org.uk/<br>
<a href="http://www.thomassabo-uk.org.uk/"><b>thomas sabo uk</b></a>, http://www.thomassabo-uk.org.uk/<br>
<a href="http://www.swarovski-uk.org.uk/"><b>swarovski uk</b></a>, http://www.swarovski-uk.org.uk/<br>
<a href="http://www.christianlouboutin.org.uk/"><b>louboutin</b></a>, http://www.christianlouboutin.org.uk/<br>
<a href="http://www.air-huarache.co.uk/"><b>air huarache</b></a>, http://www.air-huarache.co.uk/<br>
<a href="http://www.rosherun.org.uk/"><b>nike roshe</b></a>, http://www.rosherun.org.uk/<br>
<a href="http://www.thenorth-face.org.uk/"><b>the north face</b></a>, http://www.thenorth-face.org.uk/<br>
<a href="http://www.louis--vuitton.ca/"><b>louis vuitton</b></a>, http://www.louis--vuitton.ca/<br>
<a href="http://www.airjordans.us/"><b>air jordan retro</b></a>, http://www.airjordans.us/<br>
<a href="http://www.jordanretro.org/"><b>air jordan retro</b></a>, http://www.jordanretro.org/<br>
<a href="http://www.cheap-jordans.net/"><b>air jordan</b></a>, http://www.cheap-jordans.net/<br>
<a href="http://www.nikefactory.org/"><b>nike shoes</b></a>, http://www.nikefactory.org/<br>
<a href="http://www.nikestore.us/"><b>nike outlet</b></a>, http://www.nikestore.us/<br>
<a href="http://www.cheap-nikeshoes.com/"><b>nike outlet store</b></a>, http://www.cheap-nikeshoes.com/<br>
<a href="http://www.nike-air-max.us/"><b>air max 2014</b></a>, http://www.nike-air-max.us/<br>
<a href="http://www.airmax-2015.org/"><b>nike air max</b></a>, http://www.airmax-2015.org/<br>
<a href="http://www.airmax-90.org/"><b>nike air max 2014</b></a>, http://www.airmax-90.org/<br>
<a href="http://www.nikefree-run.net/"><b>nike running shoes</b></a>, http://www.nikefree-run.net/<br>
<a href="http://www.nikefree5.net/"><b>free running</b></a>, http://www.nikefree5.net/<br>
<a href="http://www.suprashoe.net/"><b>supra footwear</b></a>, http://www.suprashoe.net/<br>
<a href="http://www.newbalance-outlet.org/"><b>new balance store</b></a>, http://www.newbalance-outlet.org/<br>
<a href="http://www.montblanc--pens.net/"><b>mont blanc pens</b></a>, http://www.montblanc--pens.net/<br>
<a href="http://www.ferragamoshoes.net/"><b>ferragamo shoes</b></a>, http://www.ferragamoshoes.net/<br>
<a href="http://www.mcm-bags.net/"><b>mcm backpack</b></a>, http://www.mcm-bags.net/<br>
<a href="http://www.bottega.us/"><b>bottega veneta</b></a>, http://www.bottega.us/<br>
<a href="http://www.nikemercurial.net/"><b>soccer shoes</b></a>, http://www.nikemercurial.net/<br>
<a href="http://www.celinebags.org/"><b>celine bags</b></a>, http://www.celinebags.org/<br>
<a href="http://www.rosheruns.us/"><b>nike roshe</b></a>, http://www.rosheruns.us/<br>
<a href="http://www.nikerosherun.us/"><b>nike roshe run</b></a>, http://www.nikerosherun.us/<br>
<a href="http://www.vansshoes.us/"><b>vans outlet</b></a>, http://www.vansshoes.us/<br>
<a href="http://www.timberland-shoes.com/"><b>timberland shoes</b></a>, http://www.timberland-shoes.com/<br>
<a href="http://www.iphone-cases.us/"><b>iphone 5s cases</b></a>, http://www.iphone-cases.us/<br>
<a href="http://www.softball-bats.us/"><b>baseball bats</b></a>, http://www.softball-bats.us/<br>
<a href="http://www.babyliss-pro.net/"><b>babyliss</b></a>, http://www.babyliss-pro.net/<br>
<a href="http://www.louisvuitton-outlets.us/"><b>louis vuitton outlet stores</b></a>, http://www.louisvuitton-outlets.us/<br>
<a href="http://www.burberry-outlet.jp.net/"><b>burberry</b></a>, http://www.burberry-outlet.jp.net/<br>
<a href="http://www.louboutin.jp.net/"><b>red bottom shoes</b></a>, http://www.louboutin.jp.net/<br>
<a href="http://www.christianlouboutinshoes.jp.net/"><b>louboutin shoes</b></a>, http://www.christianlouboutinshoes.jp.net/<br>
<a href="http://www.louisvuitton.jp.net/"><b>louis vuitton outlet online</b></a>, http://www.louisvuitton.jp.net/<br>
<a href="http://www.official-pradaoutlet.com/"><b>prada shoes</b></a>, http://www.official-pradaoutlet.com/<br>
<a href="http://www.michaelkorsclance.com/"><b>michael kors outlet online</b></a>, http://www.michaelkorsclance.com/<br>
<a href="http://www.official-michaelkorsonline.com/"><b>michael kors clearance</b></a>, http://www.official-michaelkorsonline.com/<br>
<a href="http://www.tommyhilfiger.in.net/"><b>tommy hilfiger bags</b></a>, http://www.tommyhilfiger.in.net/<br>
<a href="http://www.mcmworldwide.ca/"><b>mcm bags</b></a>, http://www.mcmworldwide.ca/<br>
<a href="http://www.mmoncler-outlet.com/"><b>moncler sale</b></a>, http://www.mmoncler-outlet.com/<br>
<a href="http://www.kate-spades.com/"><b>katespade</b></a>, http://www.kate-spades.com/<br>
<a href="http://www.barbour-factory.com/"><b>barbour outlet</b></a>, http://www.barbour-factory.com/<br>
<a href="http://www.ferragamos.in.net/"><b>ferragamo outlet</b></a>, http://www.ferragamos.in.net/<br>
<a href="http://www.canada-gooser.com/"><b>canada goose coats</b></a>, http://www.canada-gooser.com/<br>
<a href="http://www.louisvuittonas.com/"><b>louis vuitton outlet stores</b></a>, http://www.louisvuittonas.com/<br>
<a href="http://www.burberry-outlet2015.com/"><b>burberry sale</b></a>, http://www.burberry-outlet2015.com/<br>
<a href="http://www.fashion-clothing.us.com/"><b>calvin klein clothes</b></a>, http://www.fashion-clothing.us.com/<br>
<a href="http://www.thenorthface.so/"><b>north face outlet</b></a>, http://www.thenorthface.so/<br>
<a href="http://www.barbour-jacketsoutlet.com/"><b>barbour jacket outlet</b></a>, http://www.barbour-jacketsoutlet.com/<br>
<a href="http://www.northfaceoutlet.in.net/"><b>north face outlet</b></a>, http://www.northfaceoutlet.in.net/<br>
<a href="http://www.northclearance.com/"><b>north clearance</b></a>, http://www.northclearance.com/<br>
<a href="http://www.burberrysfactory.com/"><b>burberry outlet online</b></a>, http://www.burberrysfactory.com/<br>
<a href="http://www.ralph-laurenuk.com/"><b>polo ralph lauren</b></a>, http://www.ralph-laurenuk.com/<br>
<a href="http://www.polo-outlets.com/"><b>ralph lauren outlet online</b></a>, http://www.polo-outlets.com/<br>
<a href="http://www.ralphlaurenr.com/"><b></b></a>, http://www.ralphlaurenr.com/<br>
<a href="http://www.monsterbeatsbydres.net/"><b>monster beats outlet</b></a>, http://www.monsterbeatsbydres.net/<br>
<a href="http://www.louis-vuittonblackfriday.com/"><b>louis vuitton outlet</b></a>, http://www.louis-vuittonblackfriday.com/<br>
<a href="http://www.lv-guccishoesfactory.com/"><b>gucci shoes uk</b></a>, http://www.lv-guccishoesfactory.com/<br>
<a href="http://www.longchampsoutlet.com/"><b>longchamp handbags</b></a>, http://www.longchampsoutlet.com/<br>
<a href="http://www.moncler-clearance.com/"><b>moncler coats</b></a>, http://www.moncler-clearance.com/<br>
<a href="http://www.ralphlaurentshirts.com/"><b>polo ralph lauren outlet</b></a>, http://www.ralphlaurentshirts.com/<br>
<a href="http://www.usahanbags.com/"><b>gucci handbags</b></a>, http://www.usahanbags.com/<br>
<a href="http://www.beatsbydreoutlet.net/"><b>beats by dre sale</b></a>, http://www.beatsbydreoutlet.net/<br>
<a href="http://www.coach-blackfriday2014.com/"><b>coach outlet store online</b></a>, http://www.coach-blackfriday2014.com/<br>
<a href="http://www.coachccoachoutlet.com/"><b>coach outlet store</b></a>, http://www.coachccoachoutlet.com/<br>
<a href="http://www.coach-clearance.com/"><b>coach clearance</b></a>, http://www.coach-clearance.com/<br>
<a href="http://www.michaelkors.in.net/"><b>michael kors handbags</b></a>, http://www.michaelkors.in.net/<br>
<a href="http://www.coach-factories.net/"><b>coach factory online</b></a>, http://www.coach-factories.net/<br>
<a href="http://www.oakley.so/"><b>oakley</b></a>, http://www.oakley.so/<br>
<a href="http://www.hermes-outletonline.com/"><b>hermes birkin</b></a>, http://www.hermes-outletonline.com/<br>
<a href="http://www.marcjacobsonsale.com/"><b>marc by marc jacobs</b></a>, http://www.marcjacobsonsale.com/<br>
<a href="http://www.nike-jordanshoes.com/"><b>air jordan shoes</b></a>, http://www.nike-jordanshoes.com/<br>
<a href="http://www.woolrich-clearance.com/"><b>woolrich jackets</b></a>, http://www.woolrich-clearance.com/<br>
<a href="http://www.coachoutletew.com/"><b>coach factory outlet</b></a>, http://www.coachoutletew.com/<br>
<a href="http://www.coachoutlet.so/"><b>coach outlet store</b></a>, http://www.coachoutlet.so/<br>
<a href="http://www.coachoutletstates.com/"><b>coach usa</b></a>, http://www.coachoutletstates.com/<br>
<a href="http://www.guccishoes-uk.com/"><b>gucci shoes</b></a>, http://www.guccishoes-uk.com/<br>
<a href="http://www.official-coachoutlets.com/"><b>coach outlet store</b></a>, http://www.official-coachoutlets.com/<br>
<a href="http://www.michaelkors.so/"><b>michael kors sale</b></a>, http://www.michaelkors.so/<br>
<a href="http://www.guccifactorys.com/"><b>gucci outlet</b></a>, http://www.guccifactorys.com/<br>
<a href="http://www.thenorthface.in.net/"><b>north face jackets</b></a>, http://www.thenorthface.in.net/<br>
<a href="http://www.cheapuggboots.eu.com/"><b>uggs on sale</b></a>, http://www.cheapuggboots.eu.com/<br>
<a href="http://www.tommy-hilfigeroutlet.com/"><b>tommy hilfiger bags</b></a>, http://www.tommy-hilfigeroutlet.com/<br>
<a href="http://www.uggboots.so/"><b>ugg boots clearance</b></a>, http://www.uggboots.so/<br>
<a href="http://www.louisvuitton.so/"><b>louis vuitton purses</b></a>, http://www.louisvuitton.so/<br>
<a href="http://www.calvin-kleins.com/"><b>cheap calvin kleins</b></a>, http://www.calvin-kleins.com/<br>
<a href="http://www.cheap-christianlouboutinshoes.com/"><b>louboutin shoes</b></a>, http://www.cheap-christianlouboutinshoes.com/<br>
<a href="http://www.airjordanshoes2015.com/"><b>retro jordans</b></a>, http://www.airjordanshoes2015.com/<br>
<a href="http://www.burberry.eu.com/"><b>burberry</b></a>, http://www.burberry.eu.com/<br>
<a href="http://www.abercrombiee.com/"><b>abercrombie kids</b></a>, http://www.abercrombiee.com/

Post comment

Nick *
Your name or nickname
E-mail
Your contact information (optional, will not be shown)
Text *
Content of your comment
Calculate *
(* - required field)
STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki