A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/7bf000be0 below:

added initial DistanceTest · AlmasB/FXGL@7bf000b · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+45

-0

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+45

-0

lines changed Original file line number Diff line number Diff line change

@@ -0,0 +1,45 @@

1 +

/*

2 +

* FXGL - JavaFX Game Library. The MIT License (MIT).

3 +

* Copyright (c) AlmasB (almaslvl@gmail.com).

4 +

* See LICENSE for details.

5 +

*/

6 + 7 +

package com.almasb.fxgl.physics.box2d.collision

8 + 9 +

import com.almasb.fxgl.physics.box2d.collision.Distance.SimplexCache

10 +

import com.almasb.fxgl.physics.box2d.collision.shapes.PolygonShape

11 +

import org.hamcrest.MatcherAssert.*

12 +

import org.hamcrest.Matchers.*

13 +

import org.junit.jupiter.api.Test

14 + 15 +

/**

16 +

*

17 +

* @author Almas Baimagambetov (almaslvl@gmail.com)

18 +

*/

19 +

class DistanceTest {

20 + 21 +

@Test

22 +

fun `distance`() {

23 +

val distance = Distance()

24 + 25 +

val shapeA = PolygonShape()

26 +

shapeA.setAsBox(0.5f, 0.5f)

27 + 28 +

val shapeB = PolygonShape()

29 +

shapeB.setAsBox(0.5f, 0.5f)

30 + 31 +

val output = DistanceOutput()

32 + 33 +

val input = DistanceInput()

34 +

input.proxyA.set(shapeA, 0)

35 +

input.proxyB.set(shapeB, 0)

36 +

input.transformB.p.set(3f, 0.5f)

37 + 38 +

val cache = SimplexCache()

39 +

cache.count = 0

40 + 41 +

distance.distance(output, cache, input)

42 + 43 +

assertThat(output.distance, `is`(2f))

44 +

}

45 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4