Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "vertices"
First story (not rant) :3
So I was asked to set problems for an online programming contest for my college (I'm a sophomore)
The participants were students from my college.
Teacher told me "make as hard as you can"
I gave it my all.
1 person solved the first question. Nobody solved the other four. :|
Not sure if I should be proud or sad.
And if you're wondering - here was my first question -
Sam wants to invest in real estate. He's got X dollars to spend. He knows the expected value per square meter of a given property. He knows the coordinates of the vertices of the polygon shaped properties he's interested in.
(both the values and coordinates for each property are given in input)
Find the maximum return on investment he can get.
(answer is, basically you calculate the area of each polygonal house using half the vector cross product, multiply it with their expected value per square meter, and then apply a dynamic programming - knapsack approach)
;-; I really thought it was a nice question man. ;-; I put so much thought into others too. ;-;
Got ignored. ;-;6
Wasted 2 days working on an obj (3d model) exporter….messed up meshes … missing faces … despair build after build …
And then the realization: Vertices in obj are 1-indexed.
nobody learned anything from the array start at 1 meme2
FUCK ME IN MY INDICES.
FUCK THE GPUS IN THEIR INDICES.
I mean... I understand (roughly) why the meshes are sent to gpu in this form, but at the same time...
...there's a reason why first thing I did when I was coding my procedural geometry generation library, was abstracting away all of that stuff...
...sadly, as many useful things, when I was looking for that lib on the start of this contract, I couldn't find it. and I was like "doesn't matter, this is a simple thing, using the library would be just a lazy overkill anyway".
two hours of playing around with two fucking triangles, trying to figure out which indexes are pointing to the correct vertices in a list containing FOUR outline paths.
(lower inner, upper inner, lower outer, upper outer, exacly in this order).
i mean, yeah, it's actually pretty straightforward stuff... for someone not as dumb as me =D
you just have two offsets, one that jumps you to start of the upper path, another that jumps you to the start of the outer path, then it's just
0 + upOffset to get the vertex extruded upwards from the zeroth of the inner path, or
0 + outOffset to get the zeroth from the outer outline, or
0 + outOffset + upOffset, to get the one extruded from zeroth outer vertex...
and so on.
simple stuff, then you just replace the zero with loop control var, put them in the right order, and voilá! walls!
except... whatever, why am I describing in such detail, not necessary, you're not my rubber duck =D
in short, figuring out which fuckin vertex is which, when the list contains ...well, any number of points, and you need to plug the gap between last and first points of the paths, where you need to wrap around the list...
...has proven to be surprisingly hard for me.
funny how much I love doing these things with meshes, despite how bad I am at doing them, which makes me hate doing them despite loving it =D2
Look at this amazing chaos game fractal.
Three vertices of an equilateral triangle and a random point p between any two vertices are taken,then we generate a random integer between 1 and 6 (just like throwing a dice) .if 2 or 4 comes on the dice we draw a point between the random point p and the vertex v1.similarly if 3 or 4 comes on dice , we draw a point between the previously drawn point and vertex v2.for 5 or 6 the vertex is v3.after a few iterations we get to see this amazing pattern30
Sometimes I just wonder how.
I spent hours trying to find out why nothing was being rendered on screen. In the end I realized that my full-screen triangle consisted of 2 vertices.
I spent the last 2 days, my father's birthday, and my birthday working on a bug for the game in developing for mobile. And I've done everything to try and fix it. Optimize the vertices, deleted assets not in use, organized all my assets into separate folders, and you know what. Fuck it. If "app not installed" I'm going to port it to PC.
Messing with three.js library. Now imagine I have a letter in 3D, from which I removed all the faces and replaced vertices with white dots (plexus effect), and all around are like thousands of dots. Now I wanted to put single sprite somewhere on that letter. So I wrote a short script doing that. Fast forward an hour. I am figuring out, why the FPS significantly dropped to like 0.5 fps or what. Checking various browsers, even downscaling image from 512x512 sprite to 64x64, checking whole stackoverflow why is just one fucking sprite causing a lot of trouble and such an fps drop. Trying everything except... I wrote that function inside loop rendering those thousands dots all around. Lol my computer almost catched in fire rendering that shit.
Must to say, in chrome it had 0.5fps, mozilla had around 15-20 fps which is A LOT better.1
Just wasted two hours because C# float.parse only allows dots for decimal places and ignores commas..... But float.tostring uses a comma WTF.
I was writing an obj file exporting the vertices with tostring, then when loading the model would show up broken but in other 3d applications it worked.
Who did come up this bright idea ?2