Tag Info

New answers tagged

1

Byte56's answer is very good, especially for the example image given where simulating the movement of each "ball" in the line will work well. I'll give you an alternative idea however which might work better, or might be easier to implement if you are trying to work with a dashed line (with or without animation), something like -- -- -- -- Calculate the ...


3

You get the path the same way you'd move the object when you shoot it. Just have a tight loop that simulates the movement of the object and keep track of the position every so often. Now you have a list of positions, if you draw a dot at each position, you have a dotted line the represents the path of the object if it were to be shot from that angle.


2

The camera analogy is a lie because there is no camera. Instead all that happens is a transformation of points in 3D space to points on a 2D screen, and the matrices define how that transformation happens. Modelview and projection are conceptually different although mathematically the same (it's all just matrix multiplication). Modelview just moves points ...


8

The graphics pipeline (typically) involves transformation from model space to world space, from world space to view space, and from view space to clip space. There is a transformation matrix associated with each of these (the world, view and projection transformations, respectively). There are of course stages of the pipeline after geometry reaches clip ...


0

You answered your question well. This is exactly how it should be done for a 3D scene at least in OpenGL (not used other graphics APIs). You create your projection matrix using your FOV, aspect ratio, near and far planes and use it to render your entities, by multiplying it against each entities own model matrix. You should only need to set your projection ...


0

I also had exactly the same thoughts as you. For my final university project I studied different methods of voxel mesh smoothing. The best method I found was Surface Nets. It produces a result that looks very similar to March Cubes but without all that lookup table hassle. You can also choose how smooth you want the object by performing more passes of the ...


2

I would comment on Josh's accepted answer, which is certainly correct, but you need 50 rep to do that and I just happened to see this on the "Hot Network Questions" sidebar. But I digress... Coming from a background in geography, there's an easy example of orthogonal vs oblique projections in remote sensing data (like the aerial imagery you see on Google or ...


6

They're both similar, in that they are both parallel projections (lines that are parallel in the source are parallel in the projection). In a parallel projection of (x, y, z) onto the xy plane becomes (x + az, y + bz, 0). When a and b are equal, the projection is orthographic; otherwise the projection is oblique. Another way to look at it is that in an ...


0

While you're right to use the quaternion as the underlying type for rotation, I'm concerned that you're exposing other fields in C++ which should be handled using getters/setters. The convention for C++ is to expose get and set methods, and leave the particulars of how the field is handled to the class. That is, excepting TDA since this is a component, ...


3

One of the visualization methods I like is to represent quaternion (orientation in 3d space) as vector (x,y,z components) + spin (the rotation around that vector, stored in w component). If you are looking for some online visualizer for quaternions, you can always use wolframalpha: http://www.wolframalpha.com/input/?i=quaternion%3A+0%2B2i-j-3k&lk=3 ...


0

Surprisingly enough, a simple Google of "the heat equation" yields kilo-calories of information on the partial-differential equations and common boundary conditions encountered in solving heat-flow problems. The derivation of the equation in one, two, or three dimensions is readily developed from Conservation of Energy and Fourier's Law. The law of heat ...


0

For determining if the plane is 'looking' towards or away from the camera, you already have some of the code. The dot product between the camera "looking" and the plane normal will be > 0 if they are facing each other, and < 0 if looking away. As for detecting if the plane is within the view frustum, you could try calculating bounds over the entire view ...


2

In theory, it will take the same time to render regardless. However, if a point occluded points in the back, then some pixels may be discarded before they are rasterized (because they failed the depth test), and I can imagine that that would be slightly faster.


0

Something like this should do it: Quaternion CreateFromLookAxis(Vector3 forward, Vector3 up) { var m2 = Vector3.Normalize(forward); // Just in case. var m0 = Vector3.Normalize(Vector3.Cross(up, m2)); var m1 = Vector3.Cross(m2, m0); var r0 = m0.x + m1.y + m2.z; var result = new Quaternion(); if (r0 > 0f) { var r1 = ...


0

You could just stare the roll value before each transform.LookAt(bezier(waypoints, handles, lookAhead)); And then just adjust the roll value as you want in a separate algorithm and then reassign it to the airplane's roll. The Euler roll 0 is always straight and 360 = 0. So the questions drictly: Use a quaternion and do a slerp to rotate to that ...


1

I need a way of translating a set of points P I suppose you mean rotating here? Let Z = (0,0,1). If cross(N,Z) has length 0, it means that all your points already lie in the desired plane. Otherwise we can build a basis of the target plane: U = normalize(cross(N,Z)) V = cross(N,U) Now to transform a point P = (x,y,0) so that it lies in your target ...


0

Your solution, thus-far, implies you are already calculating depth to determine the scale factor needed to simulate perspective. To make objects move "behind" the camera, test that same depth when you draw them and do not draw objects whose depth indicates they should be behind the camera. if (object.sceneDepth >= 0) object.Draw(); Re: (like ...


3

The Euler method as applied to games is pretty much just the naive Position + (Velocity * TimeSinceLastUpdate) formula I think you were getting at. The other methods (without getting into the calc too much) are just more accurate ways of estimating velocity and position based on multiple simultaneous forces, like friction, gravity, air density, etc. It's ...


1

You should be moving the car positive X axis instead of the environment around the car negative X axis. Then move the camera with the car.


3

Welcome to the wonderful world of continuous state motion planning. A few years ago I wrote a Gamasutra article on this topic. Here are some solutions to your problem: Navigation Meshes This works by constructing a graph of nodes and edges of your scene based on some simple rules. For instance, you can construct a Visibility Graph of the scene, which is ...


0

I come from XNA, so I've had to psuedocode in places. Here is the same math in a different shape. The math was expanded for clarity and can be optimized. Vector3 directionVector = target.transform.position - transform.position; directionVector.Y = 0; directionVector = Vector3.Normalize(directionVector); //Need to flatten transform.Forward as well, if ...


2

Edit: Okay, with a little bit of testing I'm prepared to revise my answer. Going from 2D to 3D, you must now consider that "Y" isn't always going to be up. When you try to treat 3D as 2D, you can actually make things a little more complicated. So I'll do it both ways and you can decide which way works better for you. 2D in 3D As usual, we want the ...


0

The answer, with full Java code is located on StackOverflow here Answered by: edited Dec 11 '13 at 4:14 John Paul answered Dec 11 '13 at 3:48 Dave package com.math; public class CalculatePoints { public static void main(String[] args) { // TODO Auto-generated method stub /* * dp(t) = sqrt( (r1*sin(t))^2 + (r2*cos(t))^2) circ = ...


0

Most of your efficiency benefit can come from checking against a loose bound for your whole shape (box or sphere known to contain it). When you find that the ray "might" intersect it (because it intersects a sphere or box that's not much larger), then you pretty much need to check each face. You can skip faces whose normals point away from the ray, since a ...


0

I think delta = (a2 + Math.ceil( -a2 / 360 ) * 360) - (a1 + Math.ceil( -a1 / 360 ) * 360);



Top 50 recent answers are included