This commit is contained in:
Miloslav Ciz 2024-09-09 14:10:06 +02:00
parent 5134e55998
commit a4a9624abe
11 changed files with 2078 additions and 1825 deletions

View file

@ -1,6 +1,6 @@
# Free Speech
Freedom of speech means there is no responsibility and absolutely no punishments or obstacles (such as [censorship](censorship.md)), imposed by anyone (government, [corporations](corporation.md), [culture](cutlure.md), society, technology, ...), against merely talking about anything, making any public statement and sharing or publication any kind of [information](information.md) at all. Adopting free speech is not about increasing the degree of speech tolerance as many erroneously think, it's rather a complete change of values and a switch of mentality, letting go of old, primitive kind of thinking and making the leap to a new intellectual level, to absolutely eliminating the very concept of limiting or punishing any kind of expression, therefore **free speech has to be by definition absolute and have no limit**, otherwise it's not free speech but controlled, limited speech -- trying to add exceptions to free speech is like trying to limit to whom a [free software](free_software.md) license is granted; doing so immediately makes such software non-free; free speech "with limits" is like free lunch for a low price or vegetarian food with only a little meat in it -- it's not the real thing, it just wants to be called *X* without actually being *X*. **Free speech also comes with zero responsibility** exactly by definition, as responsibility implies some forms of punishment; free speech means exactly one can say anything without fearing any burden of responsibility -- if anyone says "free speech comes with responsibility", he has absolutely no clue what he's talking about, he is not against censorship, he just advocates self censorship (i.e. censorship done internally rather than externally). If you unable to say something or afraid of saying it because of any kind of punishment -- for example sharing someone's private information or a pirated movie, saying that you hate your boss, that you'd like to fuck your cousin, that there is a bomb on a plane, that you'd like to kill someone -- you have no free speech. True freedom of speech is an essential attribute of a mature society, sadly it hasn't been implemented yet and with the [SJW](sjw.md) [cancer](cancer.md) the latest trend in society is towards eliminating free speech rather than supporting it (see e.g. [political correctness](political_correctness.md)). Speech is being widely censored by extremist groups (e.g. [LGBT](lgbt.md) and [corporations](corporation.md), see also [cancel culture](cancel_culture.md)) and states -- depending on country there exist laws against so called "[hate speech](hate_speech.md)", questioning official versions of history (see e.g. [Holocaust](holocaust.md) denial laws present in many EU states), criticizing powerful people (for example it is illegal to criticize or insult that huge inbred dick Thai king), sharing of useful information such as books ([copyright](copyright.md) censorship) etc. Free speech nowadays is being eliminated by the strategy of creating an exception to free speech, usually called "hate speech", and then classifying any undesired speech under such label and silencing it.
Freedom of speech means there is no responsibility and absolutely no punishments or obstacles (such as [censorship](censorship.md)), imposed by anyone (government, [corporations](corporation.md), [culture](cutlure.md), society, technology, ...), against merely talking about anything, making any public statement and sharing or publication any kind of [information](information.md) at all. Adopting free speech is not about increasing the degree of speech tolerance as many erroneously think, it's rather a complete change of values and a switch of mentality, letting go of old, primitive kind of thinking and making the leap to a new intellectual level, to absolutely eliminating the very concept of limiting or punishing any kind of expression, like ridding an animals of its chains instead of just speculating about how long the chain should be, therefore **free speech has to be by definition absolute and have no limit**, otherwise it's not free speech but controlled, limited speech -- trying to add exceptions to free speech is like trying to limit to whom a [free software](free_software.md) license is granted; doing so immediately makes such software non-free; free speech "with limits" is like free lunch for a low price or vegetarian food with only a little meat in it -- it's not the real thing, it just wants to be called *X* without actually being *X*. **Free speech also comes with zero responsibility** exactly by definition, as responsibility implies some forms of punishment; free speech means exactly one can say anything without fearing any burden of responsibility -- if anyone says "free speech comes with responsibility", he has absolutely no clue what he's talking about, he is not against censorship, he just advocates self censorship (i.e. censorship done internally rather than externally). If you unable to say something or afraid of saying it because of any kind of punishment -- for example sharing someone's private information or a pirated movie, saying that you hate your boss, that you'd like to fuck your cousin, that there is a bomb on a plane, that you'd like to kill someone -- you have no free speech. True freedom of speech is an essential attribute of a mature society, sadly it hasn't been implemented yet and with the [SJW](sjw.md) [cancer](cancer.md) the latest trend in society is towards eliminating free speech rather than supporting it (see e.g. [political correctness](political_correctness.md)). Speech is being widely censored by extremist groups (e.g. [LGBT](lgbt.md) and [corporations](corporation.md), see also [cancel culture](cancel_culture.md)) and states -- depending on country there exist laws against so called "[hate speech](hate_speech.md)", questioning official versions of history (see e.g. [Holocaust](holocaust.md) denial laws present in many EU states), criticizing powerful people (for example it is illegal to criticize or insult that huge inbred dick Thai king), sharing of useful information such as books ([copyright](copyright.md) censorship) etc. Free speech nowadays is being eliminated by the strategy of creating an exception to free speech, usually called "hate speech", and then classifying any undesired speech under such label and silencing it.
The basic principle of free speech says that **if you don't support freedom of speech which you dislike, you don't support free speech**. I.e. speech that you hate does not equal hate speech.

2
fun.md
View file

@ -10,7 +10,7 @@ This is subjective AF, even within a single man this depends on day, hour and mo
- the `#capitalistchallenge`: Try to win this game, you have as many shots as you want. Go to some tech store, seek the shop assistant and tell him you are deciding to buy one of two products, ask which one he would recommend. If he recommends the cheaper one you win.
- the *filters* package you will likely find in you distro's repos: You can apply funny filters to text, like for example `links -dump ~/git/less_retarded_wiki/html/algorithm.html | tail -n +10 | head -n 10 | pirate`. You may turn Wikipedia articles to Brooklyn English or haxor 1337 speech.
- the [fight culture](fight_culture.md) drinking game: Watch some [modern](modern.md) documentary, take a drink every time someone says the word *fight*. Harder mode: also drink when they say the word *[right](rights_culture.md)*.
- the [fight culture](fight_culture.md) drinking game: Watch some [modern](modern.md) documentary, take a drink every time someone says the word *fight*. Harder mode: also drink when they say the word *[right](rights_culture.md)*. If you hear "fight for the right to ..." you have to drink the whole bottle immediately. WARNING: this game is very likely to end by death from alcohol poisoning.
- [programming](programming.md)
- [games](game.md) such as [chess](chess.md), [go](go.md) and [shogi](shogi.md), [racetrack](racetrack.md), even vidya gaymes (programming them and/or playing them), but only old+libre ones
- [jokes](jokes.md)

View file

@ -50,12 +50,15 @@ In the [gender studies](gender_studies.md) circles there is an academic debate a
- [negro](negro.md)
- [faggot](faggot.md)
- [cracker](cracker.md)
- [retard](retard.md)
- [chink](chink.md)
- [troon](troon.md)
- [kike](kike.md)
- [Voldemort](voldemort.md)
- [pool's closed](pools_closed.md)
- [chocolate rain](chocolate_rain.md)
- [kurwa](kurwa.md)
- [subnormal](subnormal.md)
- [chink](chink.md)
- [no-no](nono.md)
- the [C-word](capitalism.md)
- the [P-word](person.md)

View file

@ -2,14 +2,16 @@
There are many terms that are very similar and can many times be used interchangeably. This isn't wrong per se, a slight difference may be insignificant in certain contexts and the list here may also serve as a list of synonyms to those who already know the differences. However it's important to stress it's important to know at least some of the differences for the sake of the cases where they matter. The following list tries to document some of the often confused/similar terms.
- **[1D](1d.md)** vs **[2D](2d.md)** vs **[2.5D](pseudo3d.md)** vs **[3D](3d.md)** (e.g. 2D function vs 3D function, 1D raycasting vs 2D raycasting, ...)
- **[address](address.md)** vs **[pointer](pointer.md)** vs **[reference](reference.md)** vs **[index](index.md)**
- **[AI](ai.md)** vs **[machine learning](machine_learning.md)** vs **[neural networks](neural_net.md)**
- **[algebra](algebra.md)** vs **[arithmetic](arithmetic.md)** vs **[math](math.md)**
- **[algorithm](algorithm.md)** vs **[program](program.md)** vs **[process](process.md)** vs **[heuristic](heuristic.md)**
- **[algorithm](algorithm.md)** vs **[program](program.md)** vs **[process](process.md)** vs **[heuristic](heuristic.md)** vs **[source code](source_code.md)**
- **America** vs **[USA](usa.md)**
- **[analog](analog.md)** vs **[mechanical](mechanical.md)**
- **[analog](analog.md)** vs **[mechanical](mechanical.md)** vs **non-electronic**
- **[anarchy](anarchism.md)** vs **[chaos](chaos.md)**
- **[argument](argument.md)** vs **[parameter](parameter.md)**
- **[array](array.md)** vs **[list](list.md)** vs **[tuple](tuple.md)** vs **[set](set.md)** vs **[multiset](multiset.md)**
- **[argument](argument.md)** vs **[parameter](parameter.md)** vs **formal parameter**
- **[array](array.md)** vs **[list](list.md)** vs **[tuple](tuple.md)** vs **[string](string.md)** vs **[set](set.md)** vs **[class](class.md)** vs **[multiset](multiset.md)**
- **[ASCII](ascii.md)** vs **[plain text](plain_text.md)** vs **[Unicode](unicode.md)**
- **[ASCII art](ascii_art.md)** vs **[ANSI art](ansi_art.md)** vs **[Unicode](unicode.md) art**
- **[assembler](assembler.md)** vs **[assembly](assembly.md)** vs **[machine code](machine_code.md)**
@ -20,13 +22,12 @@ There are many terms that are very similar and can many times be used interchang
- **[black](black.md) [race](race.md)** vs **[nigger](nigger.md)** vs **[negro](negro.md)**
- **[branchless](branchless.md) programming** vs **ifless programming**
- **[brute force](brute_force.md)** vs **[heuristic search](heuristic_search.md)**
- **[buffer](buffer.md)** vs **[cache](cache.md)** vs **[cash](money.md)**
- **[bug](bug.md)** vs **[glitch](glitch.md)** vs **[error](error.md)** vs **[exception](exception.md)** vs **[fault](fault.md)** vs **[failure](fail.md)** vs **[defect](defect.md)**
- **[cache](cache.md)** vs **[cash](money.md)**
- **[causation](causation.md)** vs **[correlation](correlation.md)** (le [reddit](reddit.md) scientist rule)
- **[cepstrum](cepstrum.md)** vs **[spectrum](spectrum.md)**
- **[chaos](chaos.md)** vs **[randomness](random.md)** vs **[pseudorandomness](pseudorandom.md)** vs **[entropy](entropy.md)** vs **[statistics](statistics.md)** vs **[probability](probability.md)** vs **[stochasticity](stochastic.md)**
- **[class](class.md)** vs **[set](set.md)** vs **[multiset](multiset.md)**
- **[CLI](cli.md)** vs **[TUI](tui.md)** vs **[terminal](terminal_emulator.md)** vs **[console](console.md)**
- **[CLI](cli.md)** vs **[TUI](tui.md)** vs **[terminal](terminal_emulator.md)** vs **[console](console.md)** vs **[shell](shell.md)** vs **[TTY](tty.md)**
- **[clipping](clipping.md)** vs **[culling](culling.md)** vs **[pruning](pruning.md)**
- **[closed source](closed_source.md)** vs **[proprietary](proprietary.md)**
- **[college](college.md)** vs **[university](university.md)**
@ -38,7 +39,7 @@ There are many terms that are very similar and can many times be used interchang
- **[computer science](compsci.md)** vs **[information technology](it.md)** vs **[informatics](informatics.md)** vs **[cybernetics](cybernetics.md)** vs **[computer engineering](computer_engineering.md)** vs **[software engineering](software_engineering.md)**
- **[compatibility layer](compatibility_layer.md)** vs **[emulator](emulator.md)** vs **[virtual machine](vm.md)**
- **[concurrency](concurrency.md)** vs **[parallelism](parallelism.md)** vs **[quasiparallelism](quasiparallelism.md)** vs **[distribution](distributed.md)**
- **[conjecture](conjecture.md)** vs **[hypothesis](hypothesis.md)** vs **[theory](theory.md)**
- **[conjecture](conjecture.md)** vs **[hypothesis](hypothesis.md)** vs **[theory](theory.md)** vs **[theorem](theorem.md)** vs **[lemma](lemma.md)**
- **[constant](constant.md)** vs **[literal](literal.md)**
- **[coding](coding.md)** vs **[programming](programming.md)** vs **[software engineering](software_engineering.md)**
- **[codec](codec.md)** vs **[container format](container_format.md)**
@ -46,10 +47,10 @@ There are many terms that are very similar and can many times be used interchang
- **[computational model](computational_model.md)** vs **[model of computation](model_of_computation.md)**
- **[convolution](convolution.md)** vs **[correlation](correlation.md)**
- **[copyright](copyright.md)** vs **[patent](patent.md)** vs **[trademark](trademark.md)** vs **[intellectual property](intellectual_property.md)** vs **[moral right](moral_rights.md)** etc.
- **[culling](culling.md)** vs **[pruning](pruning.md)**
- **[currency](currency.md)** vs **[money](money.md)**
- **[crossplatform/multiplatform](multiplatform.md)** vs **[portable](portability.md)**
- **[cryptography](cryptography.md)** vs **[security](security.md)** vs **[privacy](privacy.md)**
- **[cryptocurrency](crypto.md)** vs **digital currency**
- **[cryptography](cryptography.md)** vs **[security](security.md)** vs **[privacy](privacy.md)** vs **[encryption](encryption.md)**
- **[data](data.md)** vs **[information](information.md)** vs **[entropy](entropy.md)** vs **[signal](signal.md)**
- **[data structure](data_structure.md)** vs **[data type](data_type.md)**
- **[decentralized](decentralization.md)** vs **[distributed](distributed.md)**
@ -58,12 +59,13 @@ There are many terms that are very similar and can many times be used interchang
- **[democracy](democracy.md)** vs **[voting](voting.md)**
- **demonstration** vs **[proof](proof.md)**
- **[desktop environment](de.md)** vs **[window manager](wm.md)** vs **[windowing system](windowing_system.md)**
- **[duck typing](duck_typing.md)** vs **[weak typing](weak_typing.md)** vs **[dynamic typing](dynamic_typing.md)**
- **[duck typing](duck_typing.md)** vs **[weak typing](weak_typing.md)** vs **[dynamic typing](dynamic_typing.md)** vs **[no typing](untyped.md)**
- **[digit](digit.md)** vs **[number](number.md)** vs **[value](value.md)** vs **figure** vs **numeral**
- **[digital](digital.md)** vs **[electronic](electronics.md)**
- **[directed acyclic graph](dag.md)** vs **[tree](tree.md)**
- **[directory](directory.md)** vs **[folder](folder.md)**
- **[discrete Fourier transform](dft.md)** vs **[discrete time Fourier transform](dtft.md)**
- **[distro](distro.md)** vs **[GNU](gnu.md)/Linux** vs **[Linux](linux.md)** vs **[Unix](unix.md)** vs **Unix-like**
- **[electric](electricity.md)** vs **[electronic](electronics.md)**
- **electronic game** vs **[video game](video_game.md)**
- **[emoticon](emoticon.md)** vs **[emoji](emoji.md)** vs **[smiley](smiley.md)**
@ -79,14 +81,13 @@ There are many terms that are very similar and can many times be used interchang
- **[font](font.md)** vs **[typeface](typeface.md)**
- **[forwarding](forwarding.md)** vs **[routing](routing.md)** vs **[switching](switching.md)**
- **[framework](framework.md)** vs **[library](library.md)**
- **[free software](free_software.md)** vs **[open source](open_source.md)** vs **[public domain](public_domain.md)** vs **[source available](source_available.md)** vs **[freeware](freeware.md)**
- **[free software](free_software.md) (libre)** vs **[open source](open_source.md)** vs **[FOSS](foss.md)** vs **[public domain](public_domain.md)** vs **[source available](source_available.md)** vs **[freeware](freeware.md) (gratis)**
- **[gay](gay.md)** vs **[LGBT](lgbt.md)**
- **[geek](geek.md)** vs **[nerd](nerd.md)**
- **[GNU](gnu.md)/Linux** vs **[Linux](linux.md)**
- **[goniometry](goniometry.md)** vs **[trigonometry](trigonometry.md)**
- **[gradient noise](gradient_noise.md)** vs **[value noise](value_noise.md)**
- **[hyperlink](hyperlink.md)** vs **[link](link.md)** vs **[URI](uri.md)** vs **[URL](url.md)**
- **[ID](id.md)** vs **[token](token.md)** vs **[hash](hash.md)** vs **[handle](handle.md)** vs **[identifier](identifier.md)**
- **[ID](id.md)** vs **[index](index.md)** vs **[token](token.md)** vs **[hash](hash.md)** vs **[handle](handle.md)** vs **[identifier](identifier.md)**
- **[ideology](ideology.md)** vs **[philosophy](philosophy.md)** vs **[religion](religion.md)** vs **[paradigm](paradigm.md)**
- **[imperative](imperative.md) paradigm** vs **procedural paradigm** vs **[procedural generation](procgen.md)**
- **[infinite](infinity.md)** vs **[arbitrarily large/unbounded](unbounded.md)**
@ -95,7 +96,6 @@ There are many terms that are very similar and can many times be used interchang
- **[kB/mB/gB/tB](memory_units.md)** vs **[KiB/MiB/GiB/TiB](memory_units.md)**
- **[latency/ping/lag](latency.md)** vs **[throughput/bandwidth](throughput.md)**
- **[leftism](left_right.md)** vs **[pseudoleftism](pseudoleft.md)**
- **[lemma](lemma.md)** vs **[theorem](theorem.md)**
- **[liberalism](liberalism.md)** vs **[libertarianism](libertarianism.md)**
- **[license](license.md)** vs **[waiver](waiver.md)**
- **main [memory](memory.md)** vs **working memory** vs **[RAM](ram.md)**
@ -104,13 +104,11 @@ There are many terms that are very similar and can many times be used interchang
- **[method](method.md)** vs **[methodology](methodology.md)**
- **[mod](mod.md)** vs **[mode](mode.md)**
- **[modem](modem.md)** vs **[router](router.md)** vs **[switch](switch.md)**
- **[multiplatform](multiplatform.md)** vs **[portable](portability.md)**
- **[multisampling](multisampling.md)** vs **[supersampling](supersampling.md)**
- **[nationalism](nationalism.md)** vs **[patriotism](patriotism.md)**
- **[NP](p_vs_np.md)** vs **[NP-hard](np_hard.md)** vs **[NP-complete](np_complete.md)**
- **[paging](paging.md)** vs **[virtual memory](virtual_memory.md)**
- **[path tracing](path_tracing.md)** vs **[ray tracing](ray_tracing.md)** vs **[ray casting](ray_casting.md)**
- **[pointer](pointer.md)** vs **[reference](reference.md)**
- **[principal square root](principal_sqrt.md)** vs **[square root](sqrt.md)** (especially when defining [i](i.md))
- **[probability](probability.md)** vs **[probability density](probability_density.md)**
- **[pseudo](pseudo.md)** vs **[quasi](quasi.md)**
@ -118,6 +116,8 @@ There are many terms that are very similar and can many times be used interchang
- **[pseudoskeptic](pseudosceptic.md)** vs **[skeptic](skeptic.md)**
- **[shading](shading.md)** vs **[shadows](shadow.md)**
- **[science](science.md)** vs **[soyence](soyence.md)**
- **[static typing](static_typing.md)** vs **[strong typing](strong_typing.md)**
- **[strategy](strategy.md)** vs **[tactics](tactics.md)**
- **[Unicode](unicode.md)** vs **[UTF](utf.md)**
- **[webpage](webpage.md)** vs **[website](website.md)**
- **[wrap around](wrap.md)** vs **[overflow](overflow.md)**

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
# Raycasting
In [computer graphics](graphics.md) raycasting refers to a rendering technique in which we determine which parts of the scene should be drawn according to which parts of the scene are hit by rays cast from the camera; it is a simpler version of **[raytracing](raytracing.md)**. The whole idea is based on the observation that we can trace rays of light that enter the camera by going BACKWARDS, i.e. instead of tracing light from light sources we rather start from the camera and go towards the parts of the scene that reflected the light (by which we ensure we are only considering the RELEVANT paths of light that actually end up hitting the camera) -- that is we are asking the question "in order for this screen pixel to light up, where would the light be coming from?", and then computing the answer to the question. A simplified way to quickly imagine what's going on is therefore to think of drawing the scene via "scanning" it with some kind of laser beam. Despite perhaps sounding intimidating at first, raycasting is one of the [simplest](minimalism.md) rendering methods, and for that it is also quite elegant -- [we](lrs.md) definitely do recommend it.
In [computer graphics](graphics.md) raycasting refers to a rendering technique in which we determine which parts of the scene should be drawn according to which parts of the scene are hit by rays cast from the camera; it is a simpler version of **[raytracing](raytracing.md)**. The whole idea is based on the observation that we can trace rays of light that enter the camera by going BACKWARDS, i.e. instead of tracing light from light sources we rather start from the camera and go towards the parts of the scene that reflected the light (by which we ensure we are only considering the RELEVANT paths of light that actually end up hitting the camera) -- that is we are asking the question "in order for this screen pixel to light up, where would the light be coming from?", and then computing the answer to the question. A simplified way to quickly imagine what's going on is therefore to think of drawing the scene via "scanning" it with some kind of laser beam originating from the camera -- of course we do this [mathematically](math.md), using [analytic geometry](analytic_geometry.md), i.e. finding intersections of the rays with geometric shapes by solving algebraic equations. Despite perhaps sounding intimidating at first, raycasting is one of the [simplest](minimalism.md) rendering methods, and for that it is also quite elegant -- [we](lrs.md) definitely do recommend it.
Raycasting is an **image order** rendering method, meaning that we iterate over the pixels of the screen and for each determine its [color](color.md) (as opposed to object order methods that iterate over 3D objects that are then "pasted" to the screen). I.e. the image can be drawn in any order -- let's say from top left to bottom right -- and without drawing any pixel more than once or leaving out any. This is advantageous as we may leave out [double buffering](double_buffering.md) and save A LOT of memory on the extra frame buffer. We may also utilize for example [frameless rendering](frameless.md). All these attributes are why we consider raycasting so nice.
@ -298,3 +298,216 @@ How to make this more advanced? Here are some hints and tips:
- **adding [billboards](billboard.md) (sprites)**: TODO
- **reflections**: We can make our 2D raycaster a 2D [raytracer](raytracing.md), i.e. when we cast a camera ray and it hits a reflective wall (a mirror), we cast another, secondary reflected ray and trace it to see which wall it hits, i.e. which wall will get reflected in the reflective wall.
- **partly transparent walls**: We can make some walls partially transparent, both with [alpha blending](alpha.md) or textures with transparent pixels. In both cases we'll have to look not just for the first hit of the ray, but also for the next.
## 3D Raycasting
Here is a simple example of 3D raycasting in [C](c.md). To show it's possible it's only written using [fixed point](fixed_point.md). We only have two kinds of shapes in the scene: [spheres](sphere.md) and [planes](plane.md). For simplicity we also don't do many [optimizations](optimization.md). Here's the code:
```
#include <stdio.h>
#define RES_X 64 // picture width
#define RES_Y 30 // picture height
#define U 1024 // fixed point unit
#define INF 0x00ffffff // infinity value
char palette[] = "WM0KXkxocl;:,'. "; // ASCII shading palette
typedef struct { int e[3]; } V3; // 3D vector
typedef struct { V3 p0; V3 p1; } Ray; // ray
#define V(vec,el) (vec).e[el] // short for accessing vector elements
unsigned int sqrtInt(unsigned int x) // simple square root
{
unsigned int a = 1, b = x;
while (b > a) { a <<= 1; b >>= 1; }
a = (a + b) >> 1;
while (a * a > x) a--;
return a;
}
int squared(int x) { return x * x; }
V3 v3(int x, int y, int z) // creates a vector
{
V3 v; V(v,0) = x; V(v,1) = y; V(v,2) = z; return v;
}
int v3Len(V3 v) // vector length
{
return sqrtInt(V(v,0) * V(v,0) + V(v,1) * V(v,1) + V(v,2) * V(v,2));
}
V3 v3Minus(V3 a, V3 b) // vector subtraction
{
return v3(V(a,0) - V(b,0),V(a,1) - V(b,1),V(a,2) - V(b,2));
}
int v3Dot(V3 a, V3 b) // dot product
{
return (V(a,0) * V(b,0) + V(a,1) * V(b,1) + V(a,2) * V(b,2)) / U;
}
V3 v3Interpolate(V3 a, V3 b, int t)
{
return v3(V(a,0) + (t * (V(b,0) - V(a,0))) / U,
V(a,1) + (t * (V(b,1) - V(a,1))) / U,V(a,2) + (t * (V(b,2) - V(a,2))) / U);
}
V3 v3Normalize(V3 v)
{
int l = v3Len(v);
return l != 0 ? v3((V(v,0) * U) / l,(V(v,1) * U) / l,
(V(v,2) * U) / l) : v3(U,0,0);
}
V3 rayVsPlane(Ray r, int coord, int n, V3 *normal)
{
int t = V(r.p1,coord) - V(r.p0,coord);
if (t == 0) // prevent division by zero
return v3(INF,INF,INF);
t = ((n - V(r.p0,coord)) * U) / t;
if (t < 0)
return v3(INF,INF,INF);
if (normal)
{
V3 dir = v3Minus(r.p1,r.p0);
*normal = v3(0,0,0);
V(*normal,coord) = V(dir,coord);
*normal = v3Normalize(*normal);
}
return v3Interpolate(r.p0,r.p1,t);
}
V3 rayVsSphere(Ray ray, V3 center, int radius, V3 *normal)
{
V3 dir = v3Normalize(v3Minus(ray.p1,ray.p0)); // normalized direction
int tmp = v3Dot(dir,v3Minus(ray.p0,center));
int diff = // for solving quadratic equation
squared(tmp) - (squared(v3Len(v3Minus(ray.p0,center))) - squared(radius));
if (diff < 0) // no solution to quadratic equation
return v3(INF,INF,INF);
diff = sqrtInt(diff);
tmp *= -1;
tmp += (tmp + diff > tmp - diff) ? -1 * diff : diff;
if (tmp < 0) // hit behind camera?
return v3(INF,INF,INF);
V3 result =
v3((tmp * V(dir,0)) / U,(tmp * V(dir,1)) / U,(tmp * V(dir,2) / U));
if (normal)
*normal = v3Normalize(v3Minus(result,center));
return result;
}
int main(void)
{
V3 viewport = v3(U,(3 * U) / 4,U); // bottom right point of vieport
V3 light = v3Normalize(v3(-U,U/2,-U/2)); // light direction
Ray r; r.p0 = v3(0,0,0); r.p1 = viewport;
for (int y = 0; y < RES_Y; ++y) // draw columns
{
for (int x = 0; x < RES_X; ++x) // draw lines
{
V(r.p1,0) = -1 * V(viewport,0) + (x * 2 * V(viewport,0)) / (RES_X - 1);
V(r.p1,1) = -1 * V(viewport,1) + (y * 2 * V(viewport,1)) / (RES_Y - 1);
int closestDist = INF;
int object = 0;
V3 hit = v3(INF,INF,INF); // intersection point
V3 n; // hit normal
char pixel = ' ';
while (object >= 0) // cast ray against each object
{
switch (object) // here we define scene objects
{
case 0: hit = rayVsSphere(r,v3(2 * U/3,-U/3,3 * U/2),U/2,&n); break;
case 1: hit = rayVsSphere(r,v3(-U,1,6 * U),3 * U,&n); break;
case 2: hit = rayVsSphere(r,v3(-3 * U/2,U,3 * U),3 * U/2,&n); break;
case 3: hit = rayVsPlane(r,1,U,&n); break;
case 4: hit = rayVsPlane(r,0,-2 * U,&n); break;
case 5: hit = rayVsPlane(r,2,6 * U,&n); break;
default: object = -123; break; // this stops further checking
}
int dist = V(hit,2); // Z component as perpendicular dist.
if (dist < closestDist)
{
pixel = V(hit,0) == INF ? 15 :
8 + (8 * v3Dot(n,light)) / U // shade by angle of light
+ object; // this gives each object a bit different color
pixel = palette[pixel < 0 ? 0 : (pixel > 15 ? 15 : pixel)];
closestDist = dist;
}
object++;
}
putchar(pixel);
}
putchar('\n');
}
return 0;
}
```
And voila, this is what we get:
```
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;ccccccco;;;;;;;;;;;
;lllllllccco;;;;;;;;;;;;:::;;;;llccco;;;;;;;;
::;;;;lllllllcccoox;;;;:,,,,,:::::;;llcccx;;;;;;
::::;;;;;lllllllcccoxx;,''''',,,,:::;;;llcco;;;;;
,,::::;;;;;lllllllcccoo''..''''',,,,:::;;llccx;;;;
,,,:::::;;;;lllllllccc'.......'''',,,:::;;lcco;;;;
,,,,,:::::;;;;lllllllcc. ......''',,,::;;llcc;;;;
',,,,,:::::;;;;lllllll. ....'''',,:::;llcc;;;;
'',,,,,::::;;;;;llllll. ....''',,,::;;lc;;;;;
;;;llllcccooxxx:::;;;;;llllll ....'',,,::;llc;;;;;
:;;;;;;;lllccccoooxxkk:;;;;;lllll ....'',,,::;lc;;;;;;
:::;;;;;;;llllccccoooxxkkX;;;;llllll ...''',,::;lc;;;;;;;
,:::;;;;;;;;llllccccoooxxkkXX;;;lllllll ....'',,::;l;;;;;;;;;
,::::;;;;;;;;llllcccooooxxkkXX;;;llllllcc....''',,:;;;;;;;;;;;;;
,::::;;;;;;;;;llllcccoooxxxkkXK;;llllllccoo;;;;;;;;;;;;;;;;;;;;;
,::::;;;;;;;;;llllccccoooxxxkkX;;;llllllcox.....................
,:::::;;;;;;;;;llllccccoooxxxkkX;;llllllc.......................
,,:::::;;;;;;;;;llllccccoooxxkkX;;;.............................
,,:::::;;;;;;;;;;llllccccoooxxkk................................
,,,:::::;;;;;;;;;lllllcccoooxxx.................................
,,,,:::::;;;;;;;;;llllccccooo...................................
,,,,:::::;;;;;;;;;;llllcccc.....................................
,,,,,:::::;;;;;;;;;;lll.........................................
',,,,,:::::;;;;;;...............................................
'',,,,,::.......................................................
................................................................
................................................................
```
## See Also
- [raytracing](raytracing.md)
- [pathtracing](pathtracing.md)
- [conetracing](conetracing.md)
- [raymarching](raymarching.md)

39
sqrt.md
View file

@ -62,7 +62,44 @@ unsigned int sqrtInt(unsigned int x)
}
```
TODO: Heron's method
But now let's take a look at **maybe even a better algorithm** -- it only gives an approximation, however it's pretty accurate and we may modify it to give a precise value by simply adjusting the estimate at the end. The advantage is that the approximation only uses bit shifts, no multiplication! This can be crucial on some simple platforms where multiplication may be expensive. Furthermore the algorithm is pretty simple, it works like this: given input number *x*, we may imagine we have a rectangle of size 1 times *x*; now we can try to make it into square by doubling the first side and halving the other. If we get equal sides, the side length is the square root. Of course we don't always iterate to the same side sizes -- if the first side gets bigger than the other, we stop and simply average them -- and that's it! Here's the code:
{ I remember I came up with a simple form of this algorithm when I was still in elementary school, however it's pretty obvious so it probably already exists, I didn't bother checking. Measuring the speed of this the pure approximation is very fast, I measured it basically at the same speed as the stdlib float square root; the exact version is of course considerably slower -- anyway for lower input values I measured it even faster than the binary search, however for higher values not anymore. ~drummyfish }
```
unsigned int sqrtIntApprox(unsigned int x)
{
unsigned int a = 1;
while (x > a)
{
a <<= 1;
x >>= 1;
}
return (a + x) >> 1;
}
unsigned int sqrtIntExact(unsigned int x)
{
unsigned int a = 1, b = x;
while (b > a)
{
a <<= 1;
b >>= 1;
}
a = (a + b) >> 1;
while (a * a > x) // iterate to exact value
a--;
return a;
}
```
TODO: Heron's method?
The following is a **non-iterative [approximation](approximation.md)** of integer square root in [C](c.md) that has acceptable accuracy to about 1 million (maximum error from 1000 to 1000000 is about 7%): { Painstakingly made by me. This one was even faster than the stdlib function! ~drummyfish }

View file

@ -1,6 +1,6 @@
# Unix
*"Those who don't know Unix are doomed to reinvent it, poorly."* --obligatory quote by Henry Spencer
*"Those who don't know Unix are [doomed](doom.md) to reinvent it, poorly."* --obligatory quote by Henry Spencer
Unix (plurar *Unixes* or *Unices*) is an [old](old.md) [operating system](operating_system.md) developed since 1960s as a research project of [Bell Labs](bell_labs.md), which has become one of the most influential pieces of software in history and whose principles (e.g. the [Unix philosophy](unix_philosophy.md), [everything is a file](everything_is_a_file.md), ...) live on in many so called Unix-like operating systems such as [Linux](linux.md) and [BSD](bsd.md) (at least to some degree). The original system itself is no longer in use (it was later followed by a new project, [plan9](plan9.md), which itself is now pretty old), the name UNIX is nowadays a [trademark](trademark.md) and a certification. However, as someone once said, *Unix is not so much an operating system as a way of thinking*.

File diff suppressed because one or more lines are too long

View file

@ -3,9 +3,9 @@
This is an autogenerated article holding stats about this wiki.
- number of articles: 593
- number of commits: 878
- total size of all texts in bytes: 4301411
- total number of lines of article texts: 32737
- number of commits: 879
- total size of all texts in bytes: 4303045
- total number of lines of article texts: 32742
- number of script lines: 294
- occurrences of the word "person": 7
- occurrences of the word "nigger": 93
@ -35,18 +35,18 @@ longest articles:
top 50 5+ letter words:
- which (2429)
- there (1864)
- which (2431)
- there (1866)
- people (1663)
- example (1452)
- example (1454)
- other (1321)
- number (1237)
- about (1166)
- about (1167)
- software (1157)
- program (980)
- program (981)
- because (906)
- their (893)
- would (888)
- would (889)
- language (833)
- called (829)
- being (815)
@ -54,10 +54,10 @@ top 50 5+ letter words:
- things (806)
- numbers (801)
- simple (773)
- computer (755)
- without (726)
- computer (757)
- without (727)
- programming (717)
- function (707)
- function (711)
- these (684)
- different (680)
- however (670)
@ -66,29 +66,35 @@ top 50 5+ letter words:
- doesn (620)
- should (617)
- while (595)
- point (588)
- point (590)
- games (584)
- society (580)
- drummyfish (563)
- drummyfish (564)
- simply (557)
- using (552)
- using (553)
- still (552)
- though (549)
- though (550)
- possible (541)
- memory (525)
- similar (520)
- https (517)
- course (511)
- course (512)
- value (504)
- always (499)
- technology (498)
- always (498)
- basically (489)
- really (485)
- first (476)
- really (486)
- probably (476)
latest changes:
```
Date: Sun Sep 8 02:25:27 2024 +0200
lrs_dictionary.md
random_page.md
sqrt.md
wiki_pages.md
wiki_stats.md
Date: Sat Sep 7 16:47:08 2024 +0200
diogenes.md
how_to.md
@ -116,19 +122,13 @@ Date: Fri Sep 6 15:31:02 2024 +0200
wiki_pages.md
wiki_stats.md
windows.md
woman.md
Date: Thu Sep 5 21:54:17 2024 +0200
art.md
chess.md
cloudflare.md
deep_blue.md
```
most wanted pages:
- [data_type](data_type.md) (14)
- [embedded](embedded.md) (13)
- [irl](irl.md) (12)
- [embedded](embedded.md) (12)
- [complex_number](complex_number.md) (11)
- [cli](cli.md) (11)
- [buddhism](buddhism.md) (11)
@ -151,7 +151,7 @@ most popular and lonely pages:
- [lrs](lrs.md) (299)
- [capitalism](capitalism.md) (248)
- [c](c.md) (223)
- [c](c.md) (224)
- [bloat](bloat.md) (214)
- [free_software](free_software.md) (179)
- [game](game.md) (142)
@ -164,8 +164,8 @@ most popular and lonely pages:
- [gnu](gnu.md) (93)
- [fun](fun.md) (93)
- [linux](linux.md) (92)
- [censorship](censorship.md) (91)
- [programming](programming.md) (90)
- [censorship](censorship.md) (90)
- [math](math.md) (88)
- [hacking](hacking.md) (83)
- [fight_culture](fight_culture.md) (83)

View file

@ -32,7 +32,7 @@ Of course, [LRS](lrs.md) loves all living beings equally, even women. In order t
**Is there even anything women are better at than men?** Well, women seem for example more peaceful or at least less violent on average (feminism of course sees this as a "weakness" and tries to change it), though they seem to be e.g. more passive-aggressive. Nevertheless there have been a few successful queens in history, women can sometimes perhaps be good in representative roles (and other simple chair-sitting jobs), in being a "symbol", which doesn't require much of any skill (a statue of a god can do the same job really). They have also evolved to perform the tasks of housekeeping and care taking at which they may excel, but still it seems that if men fully focus on a specific task, they will beat women at anything, for example the best cooks in the world are men (in Japan it is common knowledge that sushi made by women is not as good because their hands are too warm). Sometimes women may be preferable exactly for not being as "rough" as men, e.g. as singers, therapists, sex workers etc. There were also some good English female writers actually, like Agatha Christie and J. K. Rowling, though that's still pretty weak compared to Hemingway, Goethe, Tolkien, Tolstoy, Shakespeare, Dickens, Dostoevsky etcetc.
**Can women be allowed in technology?** Well yes, sure, we don't forbid anyone from doing anything. Can a [dog](dog.md) become a writer? Maybe -- it'll be awesome when he does, but we shouldn't encourage dogs to become writers or see lack of dog writers as a problem.
**Can women be allowed in technology?** Well yes, sure, we don't forbid anyone from doing anything. Can a [dog](dog.md) become a writer? Maybe -- it'll be awesome when he does, but we shouldn't encourage dogs to become writers or see lack of dog writers as a problem. In any case **we need fewer women doing important intellectual tasks**, forcing women to do tasks vital for functioning of society has led to those tasks being done poorly and society is getting destroyed, it's not [fun](fun.md) anymore, the world is literally [collapsing](collapse.md) because women were forced to do important tasks for [political reasons](feminism.md), it is now time to prioritize saving society before [political correctness](political_correctness.md). Just admit women are dumb, stop forcing women everywhere and the numbers will get back to healthy levels. In general something like 1 woman for 1000 men doing intellectual task such as [programming](programming.md), writing or [science](science.md) is about the ratio we are probably looking for.
lol http://www.menarebetterthanwomen.com
also https://encyclopediadramatica.gay/Woman :D