Let me try to explain the situation the best I can.
Lets say I have 3 values
1, 2, 3
I tell an algorithm to split this values into x columns. Lets say x = 2 for clarification.
The algorithm determines that the group of values is best put into two columns the following way.
1st column 2nd column
---------------------------
1 ...
I came accross this:
t = Clamp(t/d, 0, 1)
but I'm not sure how to perform this operation on a vector. What are the steps to clamp a vector if one was writing their own vector implementation?
Thanks
clamp clamping a vector to a minimum and a maximum
ex:
pc = # the point you are coloring now
p0 = # start point
p1 = # end point
v...
In C#, Say you have an array of strings, which contain only characters '0' and '1':
string[] input = { "0101", "101", "11", "010101011" };
And you'd like to build a function:
public void IdentifySubstrings(string[] input) { ... }
That will produce the following:
"0101 is a substring of 010101011"
"101 is a substring of 0101"
"101 ...
For example: the array
a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, d3
represents following table
a1, b1, c1, d1
a2, b2, c2, d2
a3, b3, c3, d3
now i like to bring the array into following form
a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3
Does an algorithm exist, which takes the array (from the first form) and the dimensions of ...
I'm writing a piece of simulation software, and need an efficient way to test for collisions along a line.
The simulation is of a train crossing several switches on a track. When a wheel comes within N inches of the switch, the switch turns on, then turns off when the wheel leaves. Since all wheels are the same size, and all switches ar...
For a given int sequence check number of double palindromes, where by double palindrome we mean sequence of two same palindromes without break between them. So for example:
in 1 0 1 1 0 1 we have 1 0 1 as a palindrome which appears 2 times without a break,
in 1 0 1 5 1 0 1 we have 1 0 1 but it's separated
(apart from the other palindr...
I have this algorithm here:
pc = # the point you are coloring now
p0 = # start point
p1 = # end point
v = p1 - p0
d = Length(v)
v = Normalize(v) # or Scale(v, 1/d)
v0 = pc - p0
t = Dot(v0, v)
t = Clamp(t/d, 0, 1)
color = (start_color * t) + (end_color * (1 - t))
to generate point to point linear gradients. It works very well for me...
at workplace, the work I do is hardly near to challenging and doing that I think I might be losing the skills to look at a completely new problem and think about different ideas to solve it.
A friend suggested TopCoder.com to me, but looking at the overwhelming number of problems I can not decide how to get started?
what I want is to ...
Does anyone have an algorithm for drawing an arrow in the middle of a given line. I have searched for google but haven't found any good implementation.
P.S. I really don't mind the language, but it would be great if it was Java, since it is the language I am using for this.
Thanks in advance.
...
A is an Array of n positive int numbers
k given int
Algorithm should find if there is a pair of numbers which product gives the result
a. A[i] * A[j] = k
b. A[i] = A[j] + k
if there is such a couple the algorithm should return thier index.
thanks in advance.
...
I have textures that i'm creating and would like to antialias them. I have access to each pixel's color, given this how could I antialias the entire texture?
Thanks
...
hello.
Simple question, is it possible to simplify (or replace division or modulo by less-expensive operation)
(k/m)%n
where variables are integers and operators are C style division and modulo operators.
let me rephrase question slightly, except for case where variables are base2, under what conditions (e.g. some variable may be co...
We have a database encoded with Huffman coding. The aim here is to copy on the GPU it with its associated decoder; then on the GPU, decod the database and do stuff on this decoded database without copying back it on the CPU.
I am far to be a Huffman specialist, but the few I know shows that it seems to be an algorithm essentially based ...
suppose there is given two dimensional array
int a[][]=new int[4][4];
i am trying to find determinant of matrices please help i know how find it mathematical but i am trying to find it in programaticaly
i am using language java and c# but in this case i think c++ will be also helpfull
...
in programming there is often such tasks walk through in multi dimensional array (for simplify let take two dimensional) i need indexes of elements in two dimensional array like
left to right bottom to up and vice versa and so on please give me a few examples
...
Okay - I'm not even sure that the term is right - and I'm sure there is bound to be a term for this - but I'll do my best to explain. This is not quite a cross product here, and the order of the results are absolutely crucial.
Given:
IEnumerable<IEnumerable<string>> sets =
new[] {
/* a */ new[] { "a", "b", "c" },...
From my algorithms textbook:
The annual county horse race is bringing in three thoroughbreds who have never competed against one another. Excited, you study their past 200 races and summarize these as probability distributions over four outcomes: first (“first place”), second, third, and other.
Outcome Au...
I want to have a vertical line for indentation in the lstlisting environment, similar to what one can get in algorithm2e. I tried doing something like the code below, but the the |'s are not contiguous and the result is ugly.
\lstset{
...
showtabs=true,
tabsize=3,
tab=\hfill$|$\hfill,
...
}
...
I was wondering what constitutes as fair use for code. For example, implementing a flood fill from pseudocode from Wiki. Or if a user here gives pseudocode, does your implementation of their pseudocode constitute as fair use or is this copyright infringement. What about a modification of a C algorithm? Where are the boundaries? Thanks
...
If I have a straight line that mesures from 0 to 1, then I have colorA(255,0,0) at 0 on the line, then at 0.3 I have colorB(20,160,0) then at 1 on the line I have colorC(0,0,0). How could I find the color at 0.7?
Thanks
...