c ++ – Add momentum and torque to a cube

I want to make a cube by pressing the space bar and making a short burst of force and torque to spin the cube. I have some calculations for the impulse, but I think they are wrong, because the cube only gets faster over time and not fast in the impulse.
The formula for the impulse is p = m · v. In my case, I decided to give the cube a mass of 1.

At the moment I calculate the whole impulse thing in c ++:

                f = 8.f / dt; //force = impulse / dt
                a = f / 1; //acceleration = force / mass
                v += dt * a; //velocity = velocity + a * dt
                p = m_pObject1->getPosition()(0);
                p += v * (float)event.dt; //position= position + v * dt
                m_pObject1->setPosition(glm::vec3(p,m_pObject1->getPosition()(1), m_pObject1->getPosition()(2)));

I'm sure I'm doing something wrong here, and I'm a little lost in putting the torque here.
I hope, my code and my question are clear and I would be glad about some suggestions. 🙂

With best regards

mobile – How to prevent a Scroll Bar from hiding under iOS Safari with Momentum scrolling?

If you add -webkit-overflow-scrolling: touch; For a scrollable element, such as a div, you get a smoother scrolling experience (native momentum scrolling), but lose the ability to keep the scroll bar on. For some reason, Apple has decided that in UX it's good to hide the scroll bar most of the time.

The problem is that if only 3 items are displayed in your scrollable content and the rest is not partially cut, you will not get any indication that a scroll bar exists and other items are available.

I'd like to know if there's a way to have a scrollable div with momentum scrolling, but that never hides.

box2d – LibGDX Calculation of the correct momentum vector using touch point and body center

I'm trying to calculate the right momentum vector in terms of touch point and body center.

The impulse should be applied to the middle of the body.

I think the problem is simple, calculate the 3rd point on the same line with 2 points.

Enter image description here
(Distance between C and B should be equal to B and A)

With the newly calculated point we can find and apply the momentum vector (?)

What I really want to do is:
First we touch our object, then, as we touch the screen, we move our finger on the screen so we can aim (while calculating the third point) and if we let go of our finger impulse, we should apply it.

This is what I have written so far, but the body is moving in the wrong direction:

class MyGdxGame() : ApplicationAdapter() {

    val PPM = 32f
    val SCALE = 2f
    val TIMESTEP = 60f
    private  var positionX = 0f
    private  var positionY = 0f
    private var impulseVectorX =0f
    private var impulseVectorY = 0f
    private lateinit var world : World
    private lateinit var player:Player
    private lateinit var playerTexture: Texture
    private lateinit var b2dr: Box2DDebugRenderer

    lateinit var batch: SpriteBatch
    lateinit var camera:OrthographicCamera

    var playerIsTouched:Boolean = false

    override fun create() {
        var w = Gdx.graphics.width
        var h = Gdx.graphics.height
        camera = OrthographicCamera()
        camera.setToOrtho(false, w/SCALE, h/SCALE);

        world = World(Vector2(0f,0f),false)

        Gdx.app.log("camerax", (w/2f).toString());
        Gdx.app.log("cameray", (h/2f).toString());

        batch = SpriteBatch()
        b2dr = Box2DDebugRenderer()
        playerTexture= Texture("player.png")

        player = Player(world,150f,175f,32f)

        Gdx.input.inputProcessor = object : InputAdapter() {

            override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
              //converting touch coordinates to our actual coordinates.
                var touchPointScreen:Vector3 = Vector3(screenX.toFloat(),screenY.toFloat(),0f)
                var touchPointBox2D:Vector2  = Vector2(touchPointScreen.x / PPM,touchPointScreen.y / PPM)

                if (player.body.fixtureList.first().testPoint(touchPointBox2D) && playerIsTouched == false){
                    Gdx.app.log("touched once", "player touched");
                     playerIsTouched = true
                    impulseVectorX = 0f;
                    impulseVectorY = 0f;
                    return true

            return false

            override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {

                    var impulseVector:Vector2 = Vector2(impulseVectorX,impulseVectorY)
                    player.body.applyLinearImpulse(impulseVector,player.body.worldCenter, true)
                    playerIsTouched = false


                return super.touchUp(screenX, screenY, pointer, button)

            override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
                var touchPointScreen:Vector3 = Vector3(screenX.toFloat(),screenY.toFloat(),0f)

                var playerCenterX = player.body.position.x
                var playerCenterY = player.body.position.y
                var touchPointX = touchPointScreen.x / PPM
                var touchPointY = touchPointScreen.y / PPM
                var distanceBetweenTouchAndPlayer = sqrt((playerCenterY-touchPointY).pow(2) + (playerCenterX-touchPointX).pow(2))

                if(playerIsTouched && distanceBetweenTouchAndPlayer <= 4.5){
                  //  Gdx.app.log("touch is dragging", "draggign touch");

                    var touchPointToPlayerCenterVector: Vector2 = Vector2(playerCenterX-touchPointX,playerCenterY-touchPointY)
                    var newPointHolder:Vector2=Vector2(playerCenterX+touchPointToPlayerCenterVector.x,playerCenterY+touchPointToPlayerCenterVector.y)

                    impulseVectorX = newPointHolder.x
                    impulseVectorY = newPointHolder.y

                    Gdx.app.log("screen touch point",touchPointX.toString()+" "+touchPointY.toString())
                    Gdx.app.log("center of mass",playerCenterX.toString() +" "+ playerCenterY.toString())
                    Gdx.app.log("new point",impulseVectorX.toString() +", "+impulseVectorY.toString())

                    return true


                return super.touchDragged(screenX, screenY, pointer)


    override fun render() {
        world.step(TIMESTEP, 6, 2);

        Gdx.gl.glClearColor(1f, 0f, 0f, 1f)
        batch.draw(playerTexture,player.body.position.x*PPM - (64f/2),player.body.position.y*PPM-(64f/2),64f,64f);



    override fun dispose() {




Please check fun touchDragged() I think something's going wrong?


When an oscillator rises or falls above its reference line, it helps a dealer to select an upper or lower point. Oscillators work well in trading environments, but release premature and dangerous trading signals when a new trend breaks out of a range. When a strong trend sets in, oscillators behave like a dog pulling its owner out of the way.
An oscillator can remain overbought for weeks when a new, strong uptrend sets in which gives premature sell-signals. In a steep downtrend, it can remain oversold for weeks and give premature buy signals. Knowing when to use oscillators and when to rely on trend following indicators is a hallmark of a mature analyst


GET – Mohamed Ali Aguel – Momentum Marketing Tribe | Proxies-free

Uploader: imwarrior / Category: IM / Seeders: 2 / Leechers: 0 / Size: 2.81 GB / Snatched: 1 x times

Mohamed Ali Aguel – Momentum Marketing Tribe


Online Workshops 2019!
Places are limited and there will be no live online workshops on these topics in 2019 either.

Online Workshop Day 1

How to effectively use a single third-party tool for product research (more than 1 ninja technology is shared)
This is how you use public data to easily find winners
How to legally get inside information from your competitors (ONLY a handful of people know about it) $ 197 Value
To create your own selection system for the products to be tested, WITHOUT spending a penny on ads worth $ 297
Questions and answers until all your questions have been answered

Bonus: As you are one step ahead of the trends and can be a trend maker with a value of 147 USD
Bonus: How to put all this together step by step and have a scalable, repeatable and offloadable system to start 80% of the winners! PRICELESS

Online Workshop Day 2

How do you come up with quotes and test them for $ 147 worth
Various e-commerce funnels that we use are all outsourced. priceless
Technology stack that does not break the bank. $ 197 value
Funnel stacking value $ 247
Retargeting Ninja Tricks with Funnels $ 197 Value
Questions and answers until all your questions have been answered


If the light has momentum, why are not we pushed by it?

Weeeelll was actually your "burn" caused by this "momentum" and you were "pushed around by the sunlight momentum".

I'm sorry buddy. Physics brings you every time.

Tell me, why you believe that a two-watt solar module can hold a lead-acid battery with a power of about a thousand watts?

Do not you think you need a thousand watts charger for a thousand watts battery?

No, not if you live "automotive" and breathe! They do not stink and the law, especially the laws of physics, do not apply.

Only the law of transferring the wallet of each other on your own.


Mohamed Ali Aguel – Momentum Marketing Tribe

Mohamed Ali Aguel – Momentum Marketing Tribe

Mohamed Ali Aguel – Momentum Marketing Tribe | 2.8 GB
Genre: eLearning | Language: English
Momentum Marketing Tribe 2019 Online Workshops!

The number of seats is limited, and in 2019 there will be no live online workshops on these topics again.
Online Workshop Day 1
Efficient use of a third-party product research tool (more than one ninja technique shared) $ 147 Value
How can public data be used to easily find winners?
So you get legally insider information from your competition (ONLY a handful of people know that) $ 197 Value
How to choose your own selection system for the products to be tested WITHOUT spending a single penny on ads worth $ 297
Questions and answers until all your questions have been answered $ 297 Value
Bonus: How to stay one step ahead of trends by creating a $ 147 trend creator
Bonus: How can you put it all together step by step and have a scalable, repeatable and pageable system to win 80% winners! PRICELESS
Online Workshop Day 2
How to come up with offers and she is testing $ 147 value
Various e-commerce funnels we use are ALL MAPPED OUT. priceless
Technology stack that will not break the bank. $ 197 value
Funnel stacking value $ 247
Ninja tricks with funnels worth $ 197
Questions and answers until all your questions have been answered $ 297 Value


Plotting – calculating the density of states from momentum / energy data lists

I'm trying to compute the density of states of a 2D system when certain band structure data is organized in a particular format. Below is an example of my procedure:

Starting with a simple 2 x 2 Hamiltonian at the kx, ky represent the moments in x- and y-direction:

Delete everything
ε1 = -2 * t * Cos[kx];
ε2 = -2 * t * Cos[ky];
12 = 0.3 * t * sin[kx]*Sin[ky];
t = 1;
λ = 2.5;
h = {{ε1, ε12 + I * λ}, {ε12 - I * λ, ε2}}; 

I have written a loop that diagonalizes the above Hamiltonian at different times and calculates the energy (eigenvalues) at each one kx / ky Append a 3-vector consisting of a particular pair of pulses and corresponding energy (i.e. {px, py, max[e1, e1]}) to a list (DOS1 or dos2) at each iteration:

n = 100;
dos1 = {};
dos2 = {};
To the[i = 0, i <n, i ++,
To the[J=0j[J=0j[j=0j[j=0j< n, j++, 
    px = -Pi + 2*Pi*(i/n) + 2*(Pi/(2*n)); 
    py = -Pi + 2*Pi*(j/n) + 2*(Pi/(2*n)); 
    e1 = Eigenvalues[h /. {kx -> px, ky -> py}][[1]];
e2 = eigenvalues[h /. {kx -> px, ky -> py}][[2]];
dos1 = attach[dos1, {px, py, Max[e1, e2]}];
dos2 = attach[dos2, {px, py, Min[e1, e2]}];];]; 

Everything works well here. I can plot the band structure (a ListPlot3D Act of the DOS1 and dos2 follows from the previous loop),

I want to calculate and represent the density of states as follows:

I want to define a small energy increment (ie, an interval within Dostot[[m, 3]] from where dostot = union[dos1, dos2] and m is only a counter) and counts for each energy increment over the entire spectrum the number of moments that correspond to the energies in that interval. I think something like that (count only moments in the x-direction).

dostot = union[dos1, dos2];
dosx = {};
To the[m = 1, m <= 20000, m++,
  de = Interval[dostot[[m,3]]- 0.2, dostot[[m,3]]+ 0.2];
To the[i = 1, i <= 20000, i++, 
    dosx = Append[dosx, Count[de, dostot[[i,1]]]];];];

Of course that can not work because Dostot[[i, 1]] is a kx Impulse that is no energy Dostot[[m, 3]]So how can I calculate the momentum that corresponds to each energy gain deand how can I avoid appending all zeros that result when an impulse is not within an energy interval associated with a given element? m?

The final graph would have energy (in the specified increments) along the horizontal axis and the density of states (number of moments in each energy range) on the vertical axis.