Hello,
I have an object which has a position, a rotation angle and a scale (x and y). The overall transform matrix is as follows :
QTransform xform;
xform.translate(instance.definition.position.x, instance.definition.position.y);
xform.rotateRadians(instance.definition.rotation);
xform.scale(instance.definition.scale.x, instance.defini...
I'd like to have a straight forward C# function to get a closest point (from a point P) to a line-segment, AB. An abstract function may look like this. I've search through SO but not found a usable (by me) solution.
public Point getClosestPointFromLine(Point A, Point B, Point P);
...
Do any browsers currently support or plan to support fast array math operations, similar to what NumPy provides for Python? Here is an example to demonstrate what I mean:
var a = new NumericArray('uint32', [1, 2, 3, 4]);
var b = new NumericArray('uint32', [2, 2, 2, 2]);
var c = a.add(b); // c == [3, 4, 5, 6]
In that example, add is no...
I know how to do these mathematically but I don't actual know what they yield. I'v had formulas that required their use without actually knowing why they are required. How do they work in computer graphics? Thanks
...
I have to convert a given 16 bit integer into two 8 bit integers, which are then taken and used as output, where they are headed takes the two 8 bit integers and recombines them as 16 bit input (unfortunately out of my control). My solution works, but feels unclean. For the coarse number I am bit shifting the original number, and for t...
When researching on how to do the classic "get POI in range" problem I've found that the most used algorithms are Haversine and if you need real accuracy then Vincenty's formula. I went the first one because high accuracy wasn't an issue. However, it got me thinking on something that hits me as odd, why is that I found no references to c...
Does anyone know what "\ll" (latex) or "<<" means?
Thanks.
...
I know this isn't exactly programming related per se, but programmers are the most
probable of all people who will recognize this maybe.
I have the following (X and Y are arrays, both with 3 elements), and I cannot recognize (although it reminds me of a few things, but none quite!) what is being done here. Does it ring any bells for any...
i have a blue container that is the canvas for my text. what i'm trying to do is resize the font so that the entire text fills as much of the blue container as it can.
i have access to the height of the text content, which is both paragraphs and the line in between them. also, i have the height of the blue container, the height of eac...
Reading this question got me thinking: For a given function f, how can we know that a loop of this form:
while (x > 2)
x = f(x)
will stop for any value x? Is there some simple criterion?
(The fact that f(x) < x for x > 2 doesn't seem to help since the series may converge).
Specifically, can we prove this for sqrt and for log?
...
I have an array of nearly sorted values 28 elements long. I need to find the set of values that sums to a target value provided to the algorithm (or if exact sum cannot be found, the closest sum Below the target value).
I currently have a simple algorithm that does the job but it doesn't always find the best match. It works under idea...
I want to add a number to a var. This number should be bigger when var is small and smaller when var is big. I have calculate the optimum values: when var=1, function should add 125. When var=50 function should add 420. I was thinking about sin function, but I have no idea how to "personalize" this function to work with it. (I am using p...
I cant get around on how to express this is PHP.
I have 100 and 420 as my min and max value that I wish to obtain.
Than lets suppose I have:
1000
4534
34566
123145
12312265
Now, how can I say:
Take 4534 and knowing that 1000 = 420 and 12312265 = 100 determine 4534 value.
To make it more clear, Im trying to represent web page ranks...
I would like to maximize a function with one parameter.
So I run gradient descent (or, ascent actually): I start with an initial parameter and keep adding the gradient (times some learning rate factor that gets smaller and smaller), re-evaluate the gradient given the new parameter, and so on until convergence.
But there is one proble...
Out of pure interested, I'm curious how to create PI sequentially so that instead of the number being produced after the outcome of the process, allow the numbers to display as the process itself is being generated. If this is the case, then the number could produce itself, and I could implement garbage collection on previously seen numb...
Hi,
is there a better way to multiply and divide figures than using the * and / ?
There is a strange behavior in Chrome Firefox and Internet Explorer using those operaters:
x1 = 9999.8
x1 * 100 = 999979.9999999999
x1 * 100 / 100 = 9999.8
x1 / 100 = 99.99799999999999
http://jsbin.com/ekoye3/
I am trying to round down the user input ...
Hi,
I want to "mix" char* data in this form:
source = (source + some_primary_number) % 256;
--the 256 line is because of I need to keep the range of char.
so I can do the "mix" and "un-mix" in 2 functions - the implementation above is for the mixing and this one is for the un-mixing:
source = source - some_primary_number;
if ( so...
Hi there,
I'd like to start delving into 3d graphical coding but don't really have the requisite mathematical background, I was wondering if anyone might be able to recommend a good book that teaches the maths in a manner that's designed for someone new to the topic.
I'd appreciate any suggestions, thanks in advance.
...
A linear algebra question;
Given a k-variate normed vector u (i.e. u : ||u||_2=1)
how do you construct \Gamma_u, any arbitrary k*(k-1)
matrix of unit vectors such that (u,\Gamma_u) forms an
orthogonal basis ?
I mean: from a computationnal stand point of view:
what algorithm do you use to construct such matrices ?
Thanks in advance,...
For any N, let f(N) be the last five
digits before the trailing zeroes in
N!. For example,
9! = 362880 so f(9)=36288
10! = 3628800 so f(10)=36288
20! = 2432902008176640000 so f(20)=17664
Find f(1,000,000,000,000)
I've successfully tackled this question for the given examples, my function can correctly find f(9), f(10),...