2d

Pathfinding in 2D Arrays

半城伤御伤魂 提交于 2020-01-04 06:08:11
问题 Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 }, { 0,7,24,24,24,24,24,24,24,1,1,3,1 }, { 0,7,23,23,23,23,23,23,24,1,1,3,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,23,23,23,23,23,23,24,1,3,1,1 }, { 0,7,24,24,24,24,24,24,24,1,3,1,1 }, { 0,0,0,0,1,1,1,1,1,1,1,1,1 }, and I have HashSet full of Integers that define blocked tiles. What would be a good way so that when I click on one part of the map from

Pathfinding in 2D Arrays

[亡魂溺海] 提交于 2020-01-04 06:08:05
问题 Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 }, { 0,7,24,24,24,24,24,24,24,1,1,3,1 }, { 0,7,23,23,23,23,23,23,24,1,1,3,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,23,23,23,23,23,23,24,1,3,1,1 }, { 0,7,24,24,24,24,24,24,24,1,3,1,1 }, { 0,0,0,0,1,1,1,1,1,1,1,1,1 }, and I have HashSet full of Integers that define blocked tiles. What would be a good way so that when I click on one part of the map from

why i make a 2dsphere index ,but when i query it shows s2cursor?

拜拜、爱过 提交于 2020-01-03 05:47:08
问题 why i make a 2dsphere index ,but when i query it shows s2cursor, i think it should be geosearchcursor. the mongodb document says this: http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core cursor is a string that reports the type of cursor used by the query operation: BasicCursor indicates a full collection scan. BtreeCursor indicates that the query used an index. The cursor includes name of the index. When a query uses an index, the output of explain()

How to write a 2D vector into a binary file?

落花浮王杯 提交于 2020-01-03 02:58:30
问题 everyone! I have a 2D vector filled with unsigned chars. Now I want to save its contents into a binary file: std::vector<std::vector<unsigned char> > v2D(1920, std::vector<unsigned char>(1080)); // Populate the 2D vector here ..... FILE* fpOut; // Open for write if ( (err = fopen_s( &fpOut, "e:\\test.dat", "wb")) !=0 ) { return; } // Write the composite file size_t nCount = 1920 * 1080 * sizeof(unsigned char); int nWritten = fwrite((char *)&v2D[0][0], sizeof(unsigned char), nCount, fpOut); //

2D Lighting directional shadows?

白昼怎懂夜的黑 提交于 2020-01-02 09:59:47
问题 So I'm making a 2D game and want "realistic" lighting effects. I'm using the 2D lighting that comes with the LWRP Package i saw in this video: https://www.youtube.com/watch?v=nkgGyO9VG54 Now it looks like this: But i want my objects to throw directional shadows, like this: I am a beginner when it comes to shaders and stuff like that. Hope there is a not-too-complicated solution :) 来源: https://stackoverflow.com/questions/59531238/2d-lighting-directional-shadows

Unity LookAt 2d Equivalent

三世轮回 提交于 2020-01-02 09:29:09
问题 I'm creating a tank fighting 2D game top-down in Unity 3D in the 2D perspective active. My axises are X and Y (defaulted) and I'm trying to create a homing missile My missile code is code is: var enemyName :String; // which enemy does this shot seeks private var target :GameObject; var speed :float = 100; private var timeToTarget:float; function Start () { timeToTarget = Mathf.Abs(speed); if (timeToTarget<=0) { timeToTarget=150; } target = GameObject.Find(enemyName); Destroy(this.gameObject,

Click detection in a 2D isometric grid?

﹥>﹥吖頭↗ 提交于 2020-01-02 08:36:58
问题 I've been doing web development for years now and I'm slowly getting myself involved with game development and for my current project I've got this isometric map, where I need to use an algorithm to detect which field is being clicked on. This is all in the browser with Javascript by the way. The map It looks like this and I've added some numbers to show you the structure of the fields (tiles) and their IDs. All the fields have a center point (array of x,y) which the four corners are based on

Operate on slices of 3D image in SimpleITK and create new 3D image

隐身守侯 提交于 2020-01-02 07:26:09
问题 I have a 3D image read in to SimpleITK (using python) from a NIfTI file, take each axial slice, do something with it and re-insert the new 2D slice into a 3D volume with the (hopefully) appropriate dimensions. For example, output = sitk.Image(original.GetSize(), sitk.sitkFloat32) output.CopyInformation(original) for z in numpy.arange(original.GetDepth()): image = original[:,:,z] << Do Something in SimpleITK>> << Produce a new 2D image = newimage >> output[:,:,z] = newimage The final step is

Fast 2D illumination algorithm?

…衆ロ難τιáo~ 提交于 2020-01-02 04:42:10
问题 We have a rectangular area with translucent walls and a few light sources.We are considering only the top view,so it is a 2D problem. We need to find the approximate lighting (signal strength)at each point of the area. We need to make the algorithm really fast. The brute force method was just too slow for our purposes. You can assume that all walls attenuate by same amount, even constant amount of attenuation is acceptable. The area would be at most 1000x1000, and there would not be more than

2D Kernel Density Estimate in Matlab

喜欢而已 提交于 2020-01-01 19:18:28
问题 I am using this function to estimate kernel density in 2D. I am slightly confused by the parameters of this function however. Here is an example, viewed from directly above, where density is being calculated at each point (O) in the figure. i.e: over very small areas. I want to change the KDE function parameters so that density is computed over a larger area (for example, the area circled in red). Which parameters do I need to change? I presume it is one (or both) of these: "n: size of the n