2d

three.js skydome with gradient

那年仲夏 提交于 2019-12-08 01:28:31
问题 I would like to add a sphere with a 2d gradient as texture to create a skydome. I read that in openGL this is often solved by rendering the skybox without depthtest in an additonal pass. I disabled depthTest on my sphere so everything else is drawn in front of it, it's kinda giving me the disired effect but depending on the camera angle it clips through other objects in my scene. I was looking at several examples which make use of THREE.EffectComposer and a second scene, I may be completely

Appropriate similarity metrics for multiple sets of 2D coordinates

感情迁移 提交于 2019-12-08 01:14:12
问题 I have a collection of 2D coordinate sets (on the scale of a 100K-500K points in each set) and I am looking for the most efficient way to measure the similarity of 1 set to the other. I know of the usuals: Cosine, Jaccard/Tanimoto, etc. However I am hoping for some suggestions on any fast/efficient ones to measure similarity, especially ones that can cluster by similarity. Edit 1: The image shows what I need to do. I need to cluster all the reds, blues and greens by their shape/orientatoin,

Java - 2D array checking diagonal number board

左心房为你撑大大i 提交于 2019-12-08 00:59:25
问题 Currently I'm working on a program that generates random 0's and 1's in a 8x8 2D array board. What I have to do is check whether or not if all the numbers on the diagonal are the same (starting from the corners, not just any diagonals) example: int[][] array = { {0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 1, 1, 0, 1, 1, 0}, {0, 0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 1, 1, 1, 0} }; So if by chance all the

Retrieve 2D co-ordinate from a 3D point on a 3D plane

纵然是瞬间 提交于 2019-12-07 23:09:34
问题 I have a point a point (x, y, z) that is on a plane defined by ax+by+cz+d=0. I'm trying to figure out what the (x', y') relative to the plane, where it has a starting point of (x0, y0, z0) and the x'-axis is defined by (1,0) and the y'-axis is defined by (0,1). My major goal is to have the mouse click on a surface, and know the 2D co-ordinates on a particular surface. I've managed to intersect the ray onto a plane quite trivially. As a side-note, I'm using DirectX 9 - my familiarity with

Unity 2D游戏开发快速入门第1章创建一个简单的2D游戏

為{幸葍}努か 提交于 2019-12-07 20:12:26
Unity 2D游戏开发快速入门 第 1 章 创建一个简单的 2D 游戏 即使是现在,很多初学游戏开发的同学,在谈到 Unity 的时候,依然会认为 Unity 只能用于制作 3D 游戏的。实际上, Unity 在 2013 年发布 4.3 版本的时候,就开始提供对制作 2D 游戏的支持了。例如,提供了一些专用于开发 2D 游戏的 Unity 工具。现在 Unity 已经发布了版本 4.5 ,对 2D 游戏的支持更是完善了不少。为了说明 Unity 对 2D 游戏所提供的支持,本章会使用这些在 Unity 中原生的工具,开发一个简单的 2D 游戏。本文选自《 Unity 2D游戏开发快速入门》 1.1 地面 一般情况下我们认为“地面”是精灵的落脚点,没有这个“地面”精灵会发生坠落。因此本章创建一个 2D 游戏的第一步是,创建一个供游戏精灵落脚的“地面”。创建的具体的操作步骤是: 本文选自《 Unity 2D游戏开发快速入门》 ( 1 )新建一个游戏项目、命名、并设置为 2D 项目,如图 1-1 所示。从中可以看出本游戏项目名为 world 。 图 1-1 新建游戏项目 ( 2 )准备一个将用作 2D 游戏“地面”的图片,然后导入到新建游戏项目的 Project 视图里,如图 1-2 所示,本示例使用的“地面”图片,名为 Platform 。 提示 1

How to test if a line intersects a convex polygon?

可紊 提交于 2019-12-07 19:44:31
问题 Assume you are given the equation of a line (in 2d), and the equations of lines that form a convex polygon (the polygon could be unbounded). How do I determine if the line intersects the polygon? Furthermore, are there computational geometry libraries where such tasks are pre-defined? I ask because I'm interested not just in the 2D version but n-dimensional geometry. 回答1: For the 2D case, I think the problem simplifies a bit. The line partitions the space into two regions. If the polygon is

How to get the first column's contents from a 2D array

那年仲夏 提交于 2019-12-07 19:15:59
问题 How can I pull the first column from my 2D array? I am initialising my array in a method like this //Initialise the array with the values from the file public static float[][] data(float[][] data, Scanner scan){ int count = 0; for (int i=0;i<data.length;i++){ for (int j=0;j<data[0].length;j++){ count++; if(count<data.length*data[0].length){ for(int k=0;k<2; k++){ data[i][j] = (float) IOUtil.skipToDouble(scan); System.out.print(data[i][j] + " "); } System.out.println(); } } } return data; }

How should I implement Jumping/gravity/falling in this 2d Java Game

落花浮王杯 提交于 2019-12-07 17:43:51
问题 So Here's my Player class (The object I would like to jump on spacebar), I just don't know where to begin, are there any good resources I can read on the internet that relates to me? Any help is great, thank-you. package com.zetcode; import java.awt.Color; import java.awt.Graphics; public class Player extends Creature { private boolean jumping = false; private Creature creature; public Player(Handler handler, float x, float y) { super(handler, x, y, Creature.PLAYER_WIDTH, Creature.PLAYER

2D CAD application in WPF

醉酒当歌 提交于 2019-12-07 17:09:18
问题 I'm trying to write an CAD-like application in WPF(.NET 4.0) that needs to be able to display a lot of 2D points/lines. It will be used to display CAD-plans of entire cities with zoom, pan, rotate and point snapping on mouseover. Right now I purely use WPF. I read the objects from the CAD file draw them into a StreamGeometry, use it as stroke of a new Path and add it to a Canvas, with several transforms. My problem is that this solution doesn't scale well enough. It works fine with small CAD

python 2d array to dict

最后都变了- 提交于 2019-12-07 17:00:35
问题 I want to create a dict from lower triangle of a symmetric matrix represented as 2d array. For examples if the numpy array is; array([[0, 2, 3], [2, 0, 4], [3, 4, 0]]) then I want the dict to look like; {('1', '0'): 2, ('2', '0'): 3, ('2', '1'): 4} There is a similar post for vector; Fastest way to convert a Numpy array into a sparse dictionary? I am relatively new to python so any help/suggestoins appreciated. 回答1: >>> arr =[[0, 2, 3], [2, 0, 4], [3, 4, 0]] >>> dict(((j,i), arr[i][j]) for i