detection

Circle Collision Javascript

与世无争的帅哥 提交于 2019-12-30 04:49:13
问题 Hello I need to make for school a program in Javascript that says if circles had an collision. It doesn't need to be shown graphical. I gave it a try but my code doesn't seem to work. Hope you could help me out with a script. Here's my code what I produced. function collision (p1x, p1y, r1, p2x, p2y, r2) { var a; var x; var y; a = r1 + r2; x = p1x - p2x; y = p1y - p2y; if (a > (x*x) + (y*y)) { return true; } else { return false; } } var collision = collision(5, 500, 10, 1000, 1500, 1500);

Issue with tablet detection Synchro Digital

不羁岁月 提交于 2019-12-29 06:33:08
问题 My colleague and I have to develop and implement an application on an Android tablet for a company. We started and almost completed the development of the application in question using the Eclipse AVD (we hadn't recieved the tablet yet) and it works perfectly. We received the tablet on which the application must be installed, the model: SynchroDigital INOSOP10-4.0 RES, 10" with ICS, less than 100 €, the really cheap one. Our problem: my PC doesn't recognize the tablet (WIN7, unable to install

Resonance algorithm to detect pitches

陌路散爱 提交于 2019-12-25 03:05:44
问题 I have been looking at different methods of detecting the pitch of a tone sung into the microphone. Seeing as I want to find how closely it resonates with a particular pitch class, I wonder if I could do some sort of physics-based resonance algorithm. If you hold down to sustain pedal on the piano, and sing a tone into it, (and if you are close enough to one of its existing pitches) a note will resonate sympathetically. I would love to be able to model this behaviour. But how would I go about

PyGame Collision detection for pong and keeping the paddles on screen

我怕爱的太早我们不能终老 提交于 2019-12-25 02:57:07
问题 So my problem here is that I don't want to use classes because I don't fully understand them yet nor do I want to use sprites. I have uploaded two images to the program I am able to move the paddles and get the ball to move and bounce off the top and bottom. However I cannot get the ball to bounce off the paddles. Also I cannot keep the paddles from going down off the screen or above off the screen. Any help would be appreciated thank you. import sys import pygame pygame.init() size = width,

How to detect in a Flex app if a camera is already in use by another application?

谁说我不能喝 提交于 2019-12-24 17:12:21
问题 I am making an application that plays the video stream from the user's local system (both Windows and Mac). I use the Camera.getCamera() method and in turn Camera.names to get a list of camera attached with the system. Unfortunately, if the camera is already in use by another application, say a desktop application on user's system, the browser is crashed. Is there any way that I can detect if a specific camera from the list of available camera is already in use by any other application? 回答1:

Detectings small circles on game minimap

好久不见. 提交于 2019-12-24 13:33:16
问题 i am stuck on this problem for like 20h. The quality is not every good because on 1080p video, the minimap is less than 300px / 300px I want to detect the 10 heros circles on this images: Like this: For background removal, i can use this: The heroes portrait circle radius are between 8 to 12 because a hero portrait is like 21x21px. With this code Mat minimapMat = mgcodecs.imread("minimap.png"); Mat minimapCleanMat = Imgcodecs.imread("minimapClean.png"); Mat minimapDiffMat = new Mat(); Core

Collision detection for rotated bitmaps on Android

折月煮酒 提交于 2019-12-24 09:19:14
问题 I need pixel-perfect collision detection for my Android game. I've written some code to detect collision with "normal" bitmaps (not rotated); works fine. However, I don’t get it for rotated bitmaps. Unfortunately, Java doesn’t have a class for rotated rectangles, so I implemented one myself. It holds the position of the four corners in relation to the screen and describes the exact location/layer of its bitmap; called "itemSurface". My plan for solving the detection was to: Detect

Removing items from ArrayList upon collision (Java)?

空扰寡人 提交于 2019-12-24 05:21:47
问题 As a preface, I have searched the forums but found nothing relating to my specific situation. I just started learning Java about a week ago, and this is my first foray into object oriented programming. I'm building a basic game (think somewhat like Space Invaders when it comes to mechanics). I have a "Projectile" class, a "FallingThings" class (which is the parent class to the classes I have for objects falling down (Money, Friend, Enemy)). Each projectile that is shot is stored in an

Removing items from ArrayList upon collision (Java)?

只谈情不闲聊 提交于 2019-12-24 05:21:28
问题 As a preface, I have searched the forums but found nothing relating to my specific situation. I just started learning Java about a week ago, and this is my first foray into object oriented programming. I'm building a basic game (think somewhat like Space Invaders when it comes to mechanics). I have a "Projectile" class, a "FallingThings" class (which is the parent class to the classes I have for objects falling down (Money, Friend, Enemy)). Each projectile that is shot is stored in an

How to detect if a 2D array is inside another 2D array?

徘徊边缘 提交于 2019-12-23 19:21:52
问题 So with the help of a stack-overflow member, I have the following code: data = "needle's (which is a png image) base64 code goes here" decoded = data.decode('base64') f = cStringIO.StringIO(decoded) image = Image.open(f) needle = image.load() while True: screenshot = ImageGrab.grab() haystack = screenshot.load() if detectImage(haystack, needle): break else: time.sleep(5) I've written the following code to check if the needle is in the haystack: def detectImage(haystack, needle): counter = 0