2d

How to produce Photoshop stroke effect?

我只是一个虾纸丫 提交于 2019-12-04 15:13:07
I'm looking for a way to programmatically recreate the following effect: Give an input image: input http://www.shiny.co.il/shooshx/ConeCarv/q_input.png I want to iteratively apply the "stroke" effect. The first step looks like this: step 1 http://www.shiny.co.il/shooshx/ConeCarv/q_step1.png The second step like this: alt text http://www.shiny.co.il/shooshx/ConeCarv/q_step2.png And so on. I assume this will involves some kind of edge detection and then tracing the edge somehow. Is there a known algorithm to do this in an efficient and robust way? VonC Basically, a custom algorithm would be,

Creating 2D bins in R

巧了我就是萌 提交于 2019-12-04 14:32:42
问题 I have coordinate data in R, and I would like to determine a distribution of where my points lie. The entire space of points is a square of side length 100. I'd like to assign points to different segments on the square, for example rounded to the nearest 5. I've seen examples using cut and findinterval but i'm not sure how to use this when creating a 2d bin. Actually, what I want to be able to do is smooth the distribution so there are not huge jumps in between neighboring regions of the grid

Convert 3d 4x4 Rotation Matrix into 2d

与世无争的帅哥 提交于 2019-12-04 13:59:09
问题 Say we have a 4x4 matrix with indices like so: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33 How does one convert the rotation data (ignoring the z axis, if that helps) contained in this matrix into a single 2d rotational angle (in radians)? Background: I have a 3D .dae animation exported from Blender into the Collada format. The animation is technically 2d, all of the z axis values are 0. I'm trying to convert the 4x4 matrices into 2d translation, rotation and scale data. 回答1: Scale matrix

java applet: is there a simple way to draw and erase in a two-layered 2D scene?

扶醉桌前 提交于 2019-12-04 13:10:31
I have an applet which displays some data using circles and lines. As the data continually changes, the display is updated, which means that sometimes the circles and lines must be erased, so I just draw them in white (my background color) to erase them. (There are a lot of them, so erasing everything and then recomputing and redrawing everything except the erased item would be a horribly slow way to erase a single item.) The logic of the situation is that there are two layers that need to be displayed, and I need to be able to erase an object in one layer without affecting the other layer. I

Find world space coordinate for pixel in OpenCV

谁都会走 提交于 2019-12-04 12:41:38
问题 I need to find the world coordinate of a pixel using OpenCV. So when I take pixel (0,0) in my image (that's the upper-left corner), I want to know to what 3D world space coordinate this pixel corresponds to on my image plane. I know that a single pixel corresponds to a line of 3D points in world space, but I want specific the one that lies on the image plane itself. This is the formula of the OpenCV Pinhole model of which I have the first (intrinsics) and second (extrinsics) matrices. I know

Finding all points in certain radius of another point

拟墨画扇 提交于 2019-12-04 12:21:10
问题 I am making a simple game and stumbled upon this problem. Assume several points in 2D space. What I want is to make points close to each other interact in some way. Let me throw a picture here for better understanding of the problem: Now, the problem isn't about computing the distance . I know how to do that. At first I had around 10 points and I could simply check every combination, but as you can already assume, this is extremely inefficient with increasing number of points. What if I had a

Intersection between two lines in coordinates

孤街醉人 提交于 2019-12-04 12:19:57
问题 I can detect the intersection point of two lines, but if my line don't has the length of my screen, it detects the point, where it shouldn't be. Here a preview: So, it shouldn't detect this intersection because the horizontal line isn't that long. Code: - (NSMutableArray *) intersectWithLines:(CGPoint)startPoint andEnd:(CGPoint)endPoint { NSMutableArray *intersects = [[NSMutableArray alloc] init]; for(GameLine *line in [_lineBackground getLines]) { double lineStartX = line.startPos.x; double

Rotate rectangle around a point

江枫思渺然 提交于 2019-12-04 12:12:01
问题 How would I get 4 points rotated a certain degrees around a pointer to form a rectangle? I can rotate a point around a point, but I can't offset it to make a rectangle that isn't distorted. 回答1: If you can rotate a point around a point then it should be easy to rotate a rectangle - you just rotate 4 points. Here is a js function to rotate a point around an origin: function rotate_point(pointX, pointY, originX, originY, angle) { angle = angle * Math.PI / 180.0; return { x: Math.cos(angle) *

MPI datatype for 2 d array

大兔子大兔子 提交于 2019-12-04 12:11:14
I need to pass an array of integer arrays (basically a 2 d array )to all the processors from root.I am using MPI in C programs. How to declare MPI datatype for 2 d array.and how to send the message (should i use broadcast or scatter) You'll need to use Broadcast , because you want to send a copy of the same message to every process. Scatter breaks up a message and distributes the chunks between processes. As for how to send the data: the HIndexed datatype is for you. Suppose your 2d array is defined like this: int N; // number of arrays (first dimension) int sizes[N]; // number of elements in

Good algorithm for drawing solid 2-dimensional polygons?

回眸只為那壹抹淺笑 提交于 2019-12-04 09:53:40
问题 What is the simplest (and easiest, although that's subjective) algorithm for drawing solid (as in a single, solid color--no texture mapping) 2D polygons in memory? What is the most efficient method? I am not interested in using the GPU or any rendering method, as the output of my program will not be to the screen. 回答1: The Polygon Fill Teaching Tool will show you a very nice, simple algorithm for drawing filled polygons of any complexity. I've implemented it for embedded graphics, and it's