# csp256

Member

9

157 Neutral

• Rank
Newbie
1. ## Intersection of half-plane and square

Thank you for your responses! Unfortunately using an external library is not an option because this project is a part of me teaching someone else how to program by guiding them through solving their problem (instead of just doing it myself).   I am very interested in the Sutherland-Hodgman algorithm (and computational geometry in general) but it is overkill for the moment. I have solved my problem using the method I outlined above, plus ordering the points. I accomplished this by taking arctangent of their relative vectors around their centroid: as I said, it did not need to be fast. I need to check approximately a million such intersections only once.   The line to line segment intersection had a particularly nice solution since x or y was a constant, and the line was already in normal (parametric) form, so I could find the intersection by x = r - tan(theta) * y   or by  y = r - cot(theta) * x as needed.   I am treating theta=0,pi/2,pi,3pi/2 as special cases because it was important this individual function be no more complicated than necessary for pedagogical reasons.   Do you have any cool computational geometry resources for me (I know very little on the subject), outside the bounds of this project? I will soon check the appropriate forums/stickies.
2. ## Intersection of half-plane and square

I have a (non tilted) square bounded by the points (x, y) and (x+h, y+h). I would like to know the percentage (or area; doesn't matter) that intersects with a half plane. Performance is not a priority.   When I say half-plane, I mean the set of all points further away from (or closer to) the origin than a line of infinite extent. This line is internally specified by an angle theta, and a minimum distance S from the origin. (and a further boolean specifying if we include points "closer to origin" or "further away from origin")   How do I solve this problem?   First thought is to check for a line to line segment intersection for each edge of the square. Take the union of the square's vertices with all points returned from the previous check. This will give 4 to 6 vertices. I then throw away all vertices which fail the closer/further test. I am then left with a minimal set of convex bounding points (thus solving the problem in principle).   I am comfortable performing special case checks for theta = 0, pi/2, pi, and 3pi/2 radians to catch the special case where the line segment lies on the half plane border.   Is there a better way to do this? I feel like I am missing something obvious.

4. ## Cellular automata for hydraulic erosion?

I like toying around with World Machine and other procedural terrain generation tools. I'm also trying to learn more about general-purpose GPU programming, so I thought I would see if I could recreate one of my favorite parts of World Machine on the GPU: hydraulic erosion.   World Machine's hydraulic erosion function simulates the effect of precipitation on a heightmap, and has four outputs: an eroded heightmap, a water-flow map, a soil-deposition map, and a wear map (that shows where the erosion occurred). It does a pretty good job, and is relatively fast. The starter map you get on start up can be eroded with default settings in ~10 seconds.    I intend to replicate this basic functionality, but with an increase in speed. This is not meant to be boasting or impressive, just a consequence of using the GPU on a parallelizable problem. However I would like to improve upon it with a new feature: meanders and oxbow lakes. http://en.wikipedia.org/wiki/Meander Meanders are when rivers curve significantly, due to increased water flow and erosive force on the exterior of a bend in the river. Excessive curves may cause the river to erode an extra connection to itself, cutting off part of the river from a water source. This results in horse-shoe shaped lakes next to rivers (which may or may not dry up).   I would like to see if I can get this to happen as an emergent behavior from a properly constructed cellular automata. In order to see this sort of behavior I would need a model that allowed (1) water flowing next to a cell (which is higher than the water) to cause erosion in that cell, (2) water to flow faster on the outside of a bend, (3) faster moving water to be more erosive, (4) slower water to deposit more soil. I'm not entirely sure how to achieve that. Locally computing the gradient of water altitudes to determine flow rate each time step is the simplest method, but it also fails to achieve #2, which is an important property.    Does anyone have any ideas? I feel like I am too close to the problem and am overlooking something simple.    PS: I understand that what I am talking about is, strictly speaking, a finite element method instead of a proper CA. However, I have repeatedly seen this referred to as a CA elsewhere, so I do so here as well.
5. ## I'm tutoring a promising student who is about to make a big mistake

You are teaching him programming and math (great!), he wants to get into game design, so you want him to major in art? That doesn't sound quite correct to me... but I'm not in the industry. How'd art even get into the picture? Has he already shown interest (and natural skill) in art? If he has skill for programming, wouldn't a computer science degree be more appropriate?   He was looking at design for the wrong reason. It was because he was afraid of failure (and in art/coding it is very clear when you don't know what you're doing). He saw game design as a less intimidating alternative because of the murkier metrics of individual skill. I openly accused him of this Friday and he said "wow, you really hit the nail on the head!"   I still want him to achieve his desire to be a game designer. I do not think that going to school for game design is a good way to achieve that (I am not in industry either, just repeating what I've distilled from what I've read). I think that having a strong marketable skill, a useful trade which allows you to get your foot in the door / prove yourself, and then branching into a more executive role is the way to do it. And the best way to do digital art, is to know how to do art. The actual tools you use are fairly easy to pick up; they are not the limiting factor. For example, many people ask "how do I learn to program video games", and I tell them "learn to program". I understand the same goes for "how do i learn to make digital art" (learn to make art). I would even go so far as saying that this principle extends to design. "how do i learn to design video games" becomes "how do i learn to design", but design is inherently not a fundamental skill. It is built on top of a foundation of skills. Without that foundation, your attempts at design are as doomed as the kid who tries to make an MMO without knowing what TCP/IP is.   His math and programming skills have atrophied significantly. I'm going to work on repairing them. His experiences have given him a uniquely common reason for not having developed a baseline of skill in either art or coding. I'm sorry for being vague, but I am trying to preserve his anonymity. Just trust me on this.
6. ## I'm tutoring a promising student who is about to make a big mistake

I had a lengthy, frank discussion with him. He was exceptionally mature about it and was processing what I was saying. I am used to dealing with kids being a lot more difficult. You tell the average 17 year old that and they don't even hear you.   He is definitely leaning much more towards art.   I basically presented it as "I want you to achieve your goals. I do not think that major is the best way to do that, despite it having the same name as your desired job title. I think the best way to do that is to get a classical art degree, and use your electives/club/personal projects to build digital art / video games", but I worked up to it by expressing all the reasons first without comment about their implication.   He considered SCAD, for example, when I explained to him that he has his heart set on DigiPen for the wrong (but understandable) reasons. I think that you can do a hell of a lot worse than SCAD, but I may be biased (my sister is an alumnus).