This commit is contained in:
Miloslav Ciz 2022-08-01 20:59:33 +02:00
parent e074c9eb6e
commit 8c38cbc178
7 changed files with 34 additions and 12 deletions

View file

@ -6,6 +6,8 @@ Analytic geometry is part of [mathematics](math.md) that solves [geometric](geom
Anyway, **how does it work?** Typically we work in a 2D or 3D [Euclidean space](euclidean_space.md) with [Cartesian coordinates](cartesian_coords.md) (but of course we can generalize to more dimensions etc.). Here, geometric shapes can be described with [equations](equation.md) (or [inequalities](inequality.md)); for example a zero-centered circle in 2D with radius *r* has the equation *x^2 + y^2 = r^2* ([Pythagorean theorem](pythagorean_theorem.md)). This means that the circle is a set of all points *[x,y]* such that when substituted to the equation, the equation holds. Other shapes such as [lines](line.md), [planes](plane.md), [ellipses](ellipse.md), [parabolas](parabola.md) have similar equations. Now if we want to find intersections/unions/etc., we just solve systems of multiple equations/inequalities and find solutions (coordinates) that satisfy all equations/inequalities at once. This allows us to do basically anything we could do with pen and paper such as defining helper shapes and so on. Using these tools we can compute things such as angles, distances, areas, collision points and much more. Anyway, **how does it work?** Typically we work in a 2D or 3D [Euclidean space](euclidean_space.md) with [Cartesian coordinates](cartesian_coords.md) (but of course we can generalize to more dimensions etc.). Here, geometric shapes can be described with [equations](equation.md) (or [inequalities](inequality.md)); for example a zero-centered circle in 2D with radius *r* has the equation *x^2 + y^2 = r^2* ([Pythagorean theorem](pythagorean_theorem.md)). This means that the circle is a set of all points *[x,y]* such that when substituted to the equation, the equation holds. Other shapes such as [lines](line.md), [planes](plane.md), [ellipses](ellipse.md), [parabolas](parabola.md) have similar equations. Now if we want to find intersections/unions/etc., we just solve systems of multiple equations/inequalities and find solutions (coordinates) that satisfy all equations/inequalities at once. This allows us to do basically anything we could do with pen and paper such as defining helper shapes and so on. Using these tools we can compute things such as angles, distances, areas, collision points and much more.
Analytic geometry is closely related to [linear algebra](linear_algebra.md).
## Example ## Example
Let's say we want to find, in 2D, where a line *L* intersects a circle *C*. *L* goes through points *A = [-3,0.5]* and *B = [3,2]*. *C* has center at *[0,0]* and radius *r = 2*. Let's say we want to find, in 2D, where a line *L* intersects a circle *C*. *L* goes through points *A = [-3,0.5]* and *B = [3,2]*. *C* has center at *[0,0]* and radius *r = 2*.
@ -41,3 +43,7 @@ Solving quadratic equation is simple so we skip the details. Here we get two sol
- intersection 1: *[1.24881, 1.5622025]* - intersection 1: *[1.24881, 1.5622025]*
- intersection 2: *[-1.83704, 0.79074]* - intersection 2: *[-1.83704, 0.79074]*
## See Also
- [linear algebra](linear_algebra.md)

View file

@ -6,7 +6,7 @@ This is a relatively quick [C](c.md) tutorial.
You should probably know at least the completely basic ideas of programming before reading this (what's a [programming language](programming_language.md), [source code](source_code.md), [command line](cli.md) etc.). If you're as far as already knowing another language, this should be pretty easy to understand. You should probably know at least the completely basic ideas of programming before reading this (what's a [programming language](programming_language.md), [source code](source_code.md), [command line](cli.md) etc.). If you're as far as already knowing another language, this should be pretty easy to understand.
## About C and Programming ## About C And Programming
[C](c.md) is [C](c.md) is
@ -168,7 +168,7 @@ Let's quickly mention how you can read and write values in C so that you can beg
- `printf("%d ");`: Same as above but without a newline. - `printf("%d ");`: Same as above but without a newline.
- `scanf("%d",&x);`: Read a number from input to the variable `x`. Note there has to be `&` in front of `x`. - `scanf("%d",&x);`: Read a number from input to the variable `x`. Note there has to be `&` in front of `x`.
## Branches and Loops (If, While, For) ## Branches And Loops (If, While, For)
When creating [algorithms](algorithm.md), it's not enough to just write linear sequences of commands. Two things (called [control structures](control_structure.md)) are very important to have in addition: When creating [algorithms](algorithm.md), it's not enough to just write linear sequences of commands. Two things (called [control structures](control_structure.md)) are very important to have in addition:
@ -182,7 +182,7 @@ if (x > 10)
puts("X is greater than 10."); puts("X is greater than 10.");
``` ```
The [syntax](syntax.md) is given, we start with `if`, then brackets (`(` and `)`) follow inside which there is a condition, then a command or a block of multiple commands (inside `{` and `}`) follow. If the condition in brackets hold, the command (or block of commands) gets executed, otherwise it is skipped. The [syntax](syntax.md) is given, we start with `if`, then brackets (`(` and `)`) follow inside which there is a condition, then a command or a block of multiple commands (inside `{` and `}`) follow. If the condition in brackets holds, the command (or block of commands) gets executed, otherwise it is skipped.
Optionally there may be an *else* branch which is gets executed only if the condition does NOT hold. It is denoted with the `else` keyword which is again followed by a command or a block of multiple commands. Branching may also be nested, i.e. branches may be inside other branches. For example: Optionally there may be an *else* branch which is gets executed only if the condition does NOT hold. It is denoted with the `else` keyword which is again followed by a command or a block of multiple commands. Branching may also be nested, i.e. branches may be inside other branches. For example:
@ -289,7 +289,7 @@ The code above places a condition in the middle of an infinite loop to prevent d
Again, loops can be nested (we may have loops inside loops) and also loops can contain branches and vice versa. Again, loops can be nested (we may have loops inside loops) and also loops can contain branches and vice versa.
## Simple Game: Guess a Number ## Simple Game: Guess A Number
With what we've learned so far we can already make a simple [game](game.md): guess a number. The computer thinks a random number in range 0 to 9 and the user has to guess it. The source code is following. With what we've learned so far we can already make a simple [game](game.md): guess a number. The computer thinks a random number in range 0 to 9 and the user has to guess it. The source code is following.
@ -797,7 +797,7 @@ As a bonus, let's see a few useful compiler flags:
- `-c`: Compile only (generate object files, do not link). - `-c`: Compile only (generate object files, do not link).
- `-g`: Include debug symbols, this will be important for [debugging](debugging.md). - `-g`: Include debug symbols, this will be important for [debugging](debugging.md).
## Advanced Data Types and Variables (Structs, Arrays, Strings) ## Advanced Data Types And Variables (Structs, Arrays, Strings)
Until now we've encountered simple data types such as `int`, `char` or `float`. These identify values which can take single atomic values (e.g. numbers or text characters). Such data types are called **[primitive types](primitive_type.md)**. Until now we've encountered simple data types such as `int`, `char` or `float`. These identify values which can take single atomic values (e.g. numbers or text characters). Such data types are called **[primitive types](primitive_type.md)**.
@ -1538,7 +1538,7 @@ int main(void)
The file mode is now `"rb"` (read binary). For reading from binary files we use the `fread` function, similarly to how we used `fscanf` for reading from a text file. `fread` has these parameters: pointer where to store the read data (the memory must have sufficient space allocated!), size of one data item, number of items to read and the pointer to the file which to read from. As the first argument we pass `&byte`, i.e. the address of the variable `byte`, next 1 (we want to read a single byte whose size in bytes is 1), 1 (we want to read one byte) and the file pointer. `fread` returns the number of items read, so the `while` condition holds as long as `fread` reads bytes; once we reach end of file, `fread` can no longer read anything and returns 0 (which in C is interpreted as a false value) and the loop ends. Again, we must close the file at the end. The file mode is now `"rb"` (read binary). For reading from binary files we use the `fread` function, similarly to how we used `fscanf` for reading from a text file. `fread` has these parameters: pointer where to store the read data (the memory must have sufficient space allocated!), size of one data item, number of items to read and the pointer to the file which to read from. As the first argument we pass `&byte`, i.e. the address of the variable `byte`, next 1 (we want to read a single byte whose size in bytes is 1), 1 (we want to read one byte) and the file pointer. `fread` returns the number of items read, so the `while` condition holds as long as `fread` reads bytes; once we reach end of file, `fread` can no longer read anything and returns 0 (which in C is interpreted as a false value) and the loop ends. Again, we must close the file at the end.
## More on Functions (Recursion, Function Pointers) ## More On Functions (Recursion, Function Pointers)
There's more to be known about functions. There's more to be known about functions.
@ -1676,7 +1676,7 @@ The very basic thing we can do is to turn on automatic optimization with a compi
TODO TODO
## Where to Go Next ## Where To Go Next
We haven't covered the whole of C, not even close, but you should have pretty solid basics now. Now you just have to go and write a lot of C programs, that's the only way to truly master C. WARNING: Do not start with an ambitious project such as a 3D game. You won't make it and you'll get demotivated. Start very simple (a Tetris clone perhaps?). We haven't covered the whole of C, not even close, but you should have pretty solid basics now. Now you just have to go and write a lot of C programs, that's the only way to truly master C. WARNING: Do not start with an ambitious project such as a 3D game. You won't make it and you'll get demotivated. Start very simple (a Tetris clone perhaps?).

View file

@ -21,3 +21,4 @@ TODO
- [splinternet](splinternet.md) - [splinternet](splinternet.md)
- [Kwangmyong](kwangmyong.md) (North Korean intranet) - [Kwangmyong](kwangmyong.md) (North Korean intranet)
- [SNET](snet.md) (large computer network on Cuba) - [SNET](snet.md) (large computer network on Cuba)
- [interplanetary internet](interplanetary_internet.md)

View file

@ -0,0 +1,11 @@
# Interplanetary Internet
Interplanetary Internet is at this time still hypothetical extension of the [Internet](internet.md) to multiple planets. As mankind is getting closer to start living on other planets and bodies such as [Mars](mars.md) and [Moon](moon.md), we have to start thinking about the challenges of creating a communication network between all of them. The greatest challenge is posed by the vast distances that increase the communication delay (which arises due to the limited [speed of light](speed_of_light.md)) and make errors such as [packet loss](packet_loss.md) much more painful. Two-way communication (i.e. request-response) to Moon and Mars can take even 2 seconds and 40 minutes respectively. Also things like planet motions, eclipses etc. pose problems to solve.
We can see that e.g. [real time](real_time.md) [Earth](earth.md)-Mars communication (e.g. [chat](chat.md) or videocalls) are physically impossible, so not only do we have to create new [network](network.md) [protocols](protocol.md) that minimize the there-and-back communication (things such as [handshakes](handshakes.md) are out of question) and implement great [redundancy](redundancy.md) for reliable recovery from loss of data traveling through space, we also need to design **new [user interfaces](ui.md)** and communication paradigms, i.e. we probably need to create a new messaging software for "interplanetary chat" that will for example show the earliest time at which the sender can expect an answer etc. [Interesting](interesting.md) shit to think about.
{ TFW no [Xonotic](xonotic.md) deathmatches with our Moon friends :( ~drummyfish }
For things like [Web](web.md), each planet would likely want to have its own "subweb" (distinguished e.g. by [TLDs](tld.md)) and [caches](cache.md) of other planets' webs for quick access. This way a man on Mars wouldn't have to wait 40 minutes for downloading a webpage from the Earh web but could immediately access that webpage's slightly delayed version, which is of course much better.
Research into this has already been ongoing for some time. InterPlaNet is a protocol developed by [NASA](nasa.md) and others to be the basis for interplanetary Internet.

View file

@ -63,3 +63,4 @@ And if you just want something more obscure and [fun](fun.md), check out these:
- [demoscene](demoscene.md) - [demoscene](demoscene.md)
- [gaymes](game.md) - [gaymes](game.md)
- [Dodleston messages mystery](dodleston.md) - [Dodleston messages mystery](dodleston.md)
- [interplanetary internet](interplanetary_internet.md)

View file

@ -32,11 +32,12 @@ These are some sources you can use for research and gathering information for ar
- **[Wikipedia](wikipedia.md)**: of course, but don't limit your search to it. Searching other language Wikipedias with machine translate can also help find extra info. - **[Wikipedia](wikipedia.md)**: of course, but don't limit your search to it. Searching other language Wikipedias with machine translate can also help find extra info.
- **[Citizendium](citizendium.md)**: can offer a different angle of view from Wikipedia. - **[Citizendium](citizendium.md)**: can offer a different angle of view from Wikipedia.
- **non-SJW forks of Wikipedia**: to get past SWJ censorship/propaganda on Wikipedia try e.g. [infogalactic](infogalactic.md) or [metapedia](metapedia.md).
- **Britannica online**: proprietary, but articles are nicely written, facts are in the public domain so we can steal them. - **Britannica online**: proprietary, but articles are nicely written, facts are in the public domain so we can steal them.
- **[wikiwikiweb](wikiwikiweb.md)** - **[wikiwikiweb](wikiwikiweb.md)**
- **[Wiby](wiby.md)**: this will find nice sites of tech nerds that Google won't show among first results - **[Wiby](wiby.md)**: this will find nice sites of tech nerds that Google won't show among first results
- **[Project Gutenberg](gutenberg.md)**: mostly older books but there are already some computer related books like [RMS's](rms.md) biography or [Jargon File](jargon_file.md) - **[Project Gutenberg](gutenberg.md)**: mostly older books but there are already some computer related books like [RMS's](rms.md) biography or [Jargon File](jargon_file.md)
- **University theses**: many university theses are publicly accessible and usually nicely sum up topics, bachelor level theses may be better understandable than PhD/master theses. - **University theses** (and scientific paper of course): many university theses are publicly accessible and usually nicely sum up topics, bachelor level theses may be better understandable than PhD/master theses.
- **Slides**: slides from various presentations are actually great resources as they condense the topic into its main points, they filter out the piles of noise. - **Slides**: slides from various presentations are actually great resources as they condense the topic into its main points, they filter out the piles of noise.
- **Wikisource** and **Wikibooks** - **Wikisource** and **Wikibooks**
- **[Metapedia](metapedia.md)** - **[Metapedia](metapedia.md)**
@ -44,7 +45,7 @@ These are some sources you can use for research and gathering information for ar
- **[Internet Archive](internet_archive.md)**: A lot of things can be found on the old web that today drown in the bloat of shitsites, also Internet Archive has archives of various forums etc. - **[Internet Archive](internet_archive.md)**: A lot of things can be found on the old web that today drown in the bloat of shitsites, also Internet Archive has archives of various forums etc.
- **[YouTube](youtube.md)**: Yes, sadly this is nowadays one of the biggest sources of information which is unfortunately hidden in videos full of ads and retarded zoomers, the information is unindexed. If you are brave enough, you can dig this information out and write it here as a proper text. - **[YouTube](youtube.md)**: Yes, sadly this is nowadays one of the biggest sources of information which is unfortunately hidden in videos full of ads and retarded zoomers, the information is unindexed. If you are brave enough, you can dig this information out and write it here as a proper text.
- Try searching with different search engines than just Google (wiby, Yandex, Bing, Yahoo, ...). - Try searching with different search engines than just Google (wiby, Yandex, Bing, Yahoo, ...).
- **Non-web**: When web fails, you can search the [darknet](darknet.md), [gopher](gopher.md), [gemini](gemini.md), [usenet](usenet.md) etc. - **Non-web**: When web fails, you can search the [darknet](darknet.md), [gopher](gopher.md), [gemini](gemini.md), [usenet](usenet.md), [tor](tor.md) etc.
## Purpose ## Purpose

2
www.md
View file

@ -55,4 +55,6 @@ Other programming languages such as [PHP](php.md) can also be used on the web, b
- [Gemini](gemini.md) - [Gemini](gemini.md)
- [BBS](bbs.md) - [BBS](bbs.md)
- [Freenet](freenet.md) - [Freenet](freenet.md)
- [IPFS](ipfs.md)
- [Internet](internet.md) - [Internet](internet.md)
- [Kwangmyong](kwangmyong.md)