Questions tagged [2d]

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.

0
votes
3answers
26 views

Insert values in 2d numpy array

I am stuck on this simple issue but I can't seem to figure it out, I have a diagonal array: N = [1,2,3,4,5,6,7,8,9] A = numpy.diag(N) And I have a list of row and column indices such as this: B =...
0
votes
0answers
29 views

Initializing multidimensional array in C with user input increments

I have a use case as below A two dimensional array , the 1st value depends on the size user assigns . I know the min and max values and the increments user would like to do . For ex .. I know the ...
5
votes
4answers
64 views

Loading all values of 2d array in java

I'm attempting to create a 2d puzzle slider game. I created my own object called gamestate to store the parent gamestate and the new gamestate, as I plan on solving it using BFS. A sample array will ...
-1
votes
2answers
29 views

Stopping my play from going out of camara view (adding bounds) 2d game

I'm trying to make a where you are on blocks and have to jump from block to block, trying to avoid bombs. I'm trying to do so he can't go outside the camera. I can't seem to find any way of stopping ...
1
vote
3answers
26 views

Insert value at random place in 2D list

I'm trying to make a minesweeper game using lists in python. I have have this code so far: import random as r import sys #dimension of board and number of bombs width = int(sys.argv[1]) height = int(...
-3
votes
1answer
28 views

transforming 2D vector to 3D with angle value

I have a Vector3 which representing the position of my car. This direction is in 3D even if the direction is always in in the XY plane, so only the yaw value is changing. Now, I want to add a pitch ...
0
votes
0answers
12 views

HTML Octagon Pie Chart/Graphic

I was asked if I could make a octagonal "pie" chart. The clients will fill out a survey, it will fill in to certain areas, given the information, just 0-10. Examples: No information: With ...
1
vote
1answer
9 views

Weird indexing with 2D arrays

def matrix_multiply(arr0, arr1): finalrow = len(arr0) finalcolumn = len(arr1[0]) final = [[None]*finalcolumn] *finalrow print (final) for j in range(len(arr0)): for k in ...
1
vote
1answer
33 views

How do you stack pandas series 2D graphs into a 3D structure?

I have some longitudinal data of 1 the weights of 115 patients structured in a dataframe. When I try to plot this however will, as suspected, all graphs be superpositioned on each other making it ...
0
votes
0answers
10 views

How to scale Pixi.js Graphics consistently based on screen size

When drawing graphics with Pixi, they appear fine on mobile devices however on desktop the graphics appear very small as the renderer is a different size, currently set to the size of the window. I ...
0
votes
0answers
27 views

Some problems with the arrays dimensions i guess

With this code i want to find a minimum in from a two dimensional function using the newton method: from numpy import array from numpy.linalg import solve, norm def newton2d(f, df, x, tol=1e-12, ...
0
votes
3answers
26 views

Computing the conditional column mean of a 2D numpy array

I'm new in Python. I have a 2D np.array (ex. 50 rows and 12 columns) and I need the mean of the 3rd column when the 1st column==x and the 9th column==y. I can't figure out how to do it without using ...
1
vote
4answers
63 views

MissingReferenceException: The object of type 'Attacker' has been destroyed but you are still trying to access it

I am getting the above error and I tried to use debug.log to print where the error is. I am creating a type of tank obj. which fire to some instantiated obj. Instantiated object are attacker. In ...
0
votes
0answers
27 views

How to make swinging hoist in specific angle, and make it move into directions its aim?

I'm trying to make a 2d game in Unity. After some experiments with Hinge Joint2D, I can't find solution to my problem. I want a hoist(player) to swing in specific angle(Dont want to pull after screen) ...
1
vote
1answer
53 views

How do I animate 2d legs in OpenGL to swing back and forth? C++

I have a programming assignment that one portion is swinging the legs back and forth in order to create a walking motion. To me this is what should logically work. It should be 20 steps, each loop ...
0
votes
2answers
47 views

What Happens When Setting transform.up in Unity

What happens when I set the transform.up value in unity. Specifically could you explain this video in the link below https://youtu.be/_XdqA3xbP2A I know it changes what the object is looking at. But,...
0
votes
1answer
25 views

Can't properly display chess pieces in small JavaScript game - JavaScript Canvas

I'm trying to build a small chess game using the JS canvas (classical, I know). I'm facing a problem with displaying the chess pieces on the board. I've created the pieces using the ES6 class and 2 ...
0
votes
0answers
7 views

How to create a 2d mesh with points on it graphically in Python (Pycharm)?

I am trying to solve some Reinforcement learning problems. For this I want to get a basic example with a 2D grid (graphically, not just with X's or something) to create an RL task on it. I use ...
0
votes
0answers
10 views

Converting an STL file 3D image into a 2D image

Preferably looking for a script since I will be needing to process thousands of files. I have done some research and was only able to find 2D to 3D instead of the other way around.
0
votes
1answer
30 views

Libgdx Spritebatch bug

however, i have a weird issue, when drawing, it seems the outside 1px of an image is stretched to fit a rectangle, but the inside is only stetched to an extend, i was drawing to 48x48 tiles, but drew ...
0
votes
1answer
53 views

Powershell - Creating an 2D array inside a class

I'm trying to create a "matrix / multidimansional array) inside a class function whit a loop. Also (because I'm used to other languages) couldn't get it to work. Is there somebody who could help me ...
2
votes
1answer
41 views

LibGDX - Mouse sensitivity affected by framerate while cursor is catched

I am developing a small top-down view game. Camera can be moved by mouse within a certain view range, while the cursor is hidden using Gdx.input.setCursorCatched(true) and an artificial one is drawn ...
1
vote
1answer
30 views

What values should I send to normalized view matrix so a tilemap scrolling only spans a tile?

This is the code that produces the projection, view and model matrices that get sent to the shader: GL.glEnable(GL.GL_BLEND) GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) ...
1
vote
1answer
42 views

Checking if point is in front

I'm building a small application that takes the user's device's lat/long position as well as the heading (true north) and tells you what sort of points of interests are in front of the user. I am ...
0
votes
2answers
45 views

How to rotate (x, y) for grid snapping

I've made grid snapping for normal square grid based on what I assume is a popular method for doing so int newX = Math.Round(oldX / gridCubeWidth) * gridCubeWidth; int newY = Math.Round(oldY / ...
2
votes
2answers
54 views

Check if two sets of points are in different hemispheres from a source point

I have a 2D plan with integer coordinates. On this plan, there are many points, separated in three categories. The "Source". There is only a single point that is the source. The Nice Group, ...
-1
votes
0answers
26 views

Get Mouse position relative to 32x32 grid

I am working on a 2D platformer game where you have a player character and enemies that are trying to kill you by shooting bullets... however, the way I chose to place the blocks was to take a small ...
0
votes
2answers
26 views

Is it nesessary to separate data structures and algorithms for 2D and 3D geometry and mechanical problems?

I have developed a library which can solve 3d geometry problems and specific 3d mechanical problems . Now, I am invited to design a similar library to solve 2D problems. Do I need to redefined ...
0
votes
1answer
38 views

Passing 2D char array in C [duplicate]

There is a warning showing incompatible pointer conversion and a note is also there in line 4 "expected char** but argument is of type char *[2]". But why please help and explain. And is this problem ...
0
votes
1answer
32 views

Counting the amount of times a number appears in a 2D array C

I am trying to count the amount of times a number appears in a 2D array, but when I try and print values it starts giving me wrong numbers after the first element. I am trying to figure this out for a ...
0
votes
0answers
16 views

In SVG is it possible to push/pop matrix transforms?

I am using SVG for an drawing app. I have a background in 3D graphics and one thing I see missing is the ability to push and pop matrix transforms. How is this essential task handled in SVG?
1
vote
1answer
52 views

Distribute evenly in 2D

So i'm trying to distribute 2D items evenly accros the screen. Right now I have it working in a way where i select all items and it calculates the size of the canvas, than calculates all widths of ...
0
votes
1answer
42 views

Load Spritesheet/Atlas through Streaming Assets

I am trying to allow a degree of modding in my Unity game by utilizing streaming assets. I can import a single sprite no problem, but I am not sure how to set an imported streaming assets sprite to ...
1
vote
1answer
29 views

How to change the size of some ArrayList in a 2d ArrayList?

I have this class to implement a 2d ArrayList. I want the method criaDimensao() to put values inside the ArrayList at index position of matriz only but it keeps putting value in all indexes of matriz. ...
-1
votes
2answers
21 views

moving rows in 2D arrays

I currently have a 2d array like this array = [ [a1, a2, a3, a4], [b1, b2, b3, b4], [c1, c2, c3, c4], [d1, d2, d3, d4], ] want I want to do is change the array ...
1
vote
2answers
26 views

Some objects are not showing until i am not near

Some objects in the game are not showing. 2D game. In editor 3D mode they are NOT showing too, until i fly near to them. In 2D editor everything is fine. I use prefab for making these objects. How can ...
0
votes
1answer
21 views

C++ Search a 2D vector for elements surrounding a chosen element?

Stuck here in my assignment. I am working with 2D Vectors. What my professor wants us to do is write a program that has the user enter a size of a matrix (N X N) and print the matrix with random 1's ...
0
votes
1answer
12 views

Mapping boundingRect()'s to parent item and intersecting yields unexpected results for collision handling

Here is how I'm handling collision of two graphics items. It gets called in mouseMoveEvent as well as itemChange. Like so: void GraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { ...
-1
votes
0answers
8 views

Writing a bullet library for 2d game

I have been working with the idea now of developing my own library to handle bullet collision and manipulation In a 2d game. I know that I am going to have to choose a language to write this in. I am ...
-2
votes
0answers
24 views

How would I traverse a 2d array in JavaScript and push only one variable per row/column into another array?

I made a 2D array with two nested for loops, and I'm trying to push only one x or y value per row or column. var boardsquare = function(){ var i; var j; for (i = 0; i < guiParams.bsize; ...
-1
votes
3answers
42 views

How do I find the smallest, largest value and total and the average in a 2D list that the user provides in python?

How do I find the smallest, largest value and total and the average in a 2D list that the user provides in python?
0
votes
1answer
57 views

Parse a simple 2d Array string to Java 2d String Array

I have this simple json string of two dimensional(2d) arrays and want to convert to JAVA 2d String Array like String[][]. String "[ [\"case1\",[\"case1-a\"]], [\"case2\",[\"case2-a\",\"case2-b\",\"...
0
votes
0answers
92 views

Constrain direction with linear programming (simplex)

I want to make a modular 2D spaceship game. The user can use building blocks to create the ship. Blocks can be squares but also other shapes that do not fit in a grid. To calculate what thrusters ...
-3
votes
0answers
32 views

Match a string to one of the strings in a 2D character array

I am working on a C program which checks C keywords for a source program in a file. My approach is to get each sentence from the file and to take out the words from that sentence. Next, compare the ...
1
vote
0answers
42 views

Android studio 2D Map Navigation

i'd like to know what to use a create a 2D navigation map on android studio , like a map of a store in which you can navigate , see your position etc ... For example : You wanna know where the milk ...
0
votes
0answers
30 views

Java Stack with 2D Array and pulling data from files

I'm working on a program to pull data from a file in a 2D Array in java it has to use a custom-made stack class. I'm having issues as 1) I don't know the total size of the array I need to intialize ...
0
votes
4answers
54 views

JAVA GET API - 2D Array, Unable to retrieve?

I am getting a data varilable through an API like this (notice square brackets): [ ["2018-09-03",287.5,289.8,286.15,287.3,287.65,1649749.0,4750.35], ["2018-08-31",286.25,290.5,285.0,285.5,285....
0
votes
0answers
11 views

How to remove artifacts / flatten a polygon?

I don't really know how to ask this question correctly. I have some polygons which have very short edges. I want to flatten (remove) those edges. The polygon is not necessarily rectangular. Do you ...
-3
votes
2answers
39 views

Best score array

So I have to do this "print test scores, find overall average of class, and which row has the best average." and I am confused as I can be public class TESTAVG { public static void main(String[]...
0
votes
1answer
50 views

Unity: Game Object cannot move to right for the first time I press right arrow of keyboard

Update: after go further with this book, I get the reason. It is the box colliders limitation of Unity it said in book. So I think we could close this ticket. What said in the book: "Right now, if ...