From 364e16e0e6914b6a42f195b3b1e35b93818b04fd Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Sun, 29 Oct 2023 00:06:54 +0200 Subject: [PATCH] Update --- line.md | 19 ++++++++++++++++++- main.md | 2 +- public_domain_computer.md | 22 +++++++++++++--------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/line.md b/line.md index 32affcc..8094cd3 100644 --- a/line.md +++ b/line.md @@ -13,7 +13,7 @@ Line is a one [dimensional](dimension.md) shape, i.e. any of its points can be d *some lines, in case you haven't seen one yet* -## Equations +## Representing Lines With Equations Mathematically lines can be defined by equations with space coordinates (see [analytic geometry](analytic_geometry.md)) -- this is pretty important for example for [programming](programming.md) as many times we need to compute intersections with lines; for example [ray casting](ray_casting.md) is a method of 3D rendering that "shoots lines from camera" and looks at which objects the lines intersect. Line equations can have different "formats", the two most important are: @@ -44,6 +44,23 @@ Here *P* is a point that lies on the line, i.e. we may again use e.g. the point Now for whatever *t* we plug into these equations we get the *[x,y]* coordinates of a point that lies on the line; for example for *t = 0* we get *x = 1 + 0 * 3 = 1* and *y = 2 + 0 * 1 = 2*, i.e. the point *A* itself. As an exercise you may try substituting other values of *t*, plotting the points and verifying they lie on a line. +## Formulas + +Here let be formulas for computing various things related to lines and line segments. + +Consider two dimensional plane. Let *L* be a line (or line segment) going from point *L1 = [L1x,L1y]* to point *L2 = [L2x,L2y]*. Let *dx = L2x - L1x* and *dy = L2y - L1y*. Let *K* be another line (or line segment). Let *P = [Px,Py]* be a point. + +- **line segment [length](length.md)**: Use [Pythagorean theorem](pythagorean_theorem.md): *length(L) = sqrt(dx^2 + dy^2)*. The same goes for a line in 3D. +- **determine which side of line L point P lies on**: A simple way is to use the simple formula for [triangle](triangle.md) winding, i.e. determine if triangle *[L1,L2,P]* goes clockwise or counterclockwise. This can also determine if the point lies exactly on the line (i.e. lies on neither side). +- **shortest distance of point P from line L**: TODO +- **intersection of lines (or line segments) L and K**: Represent the lines with their equations (see above), preferably parametric (allows any angle), put both points equal and solve the system of equations (watch out for the cases with no or many solutions). For line segments you also additionally have to check whether the intersection you find lies within BOTH line segments (with parametric representations this is easily done by checking if both parameters you get as a solution lie in the range 0 to 1). +- **angle between lines L and K**: TODO +- **distance of lines P and L**: TODO +- **project point P orthogonally to line L**: TODO +- TODO: more + +TODO: 3D lines + ## Line Drawing Algorithms Drawing lines with computers is a subject of [computer graphics](graphics.md). On specific devices such as [vector monitors](vector_monitor.md) this may be a trivial task, however as most display devices nowadays work with [raster graphics](raster_graphics.md), let's from now on focus only on such devices. diff --git a/main.md b/main.md index 0a22d1a..1c595f2 100644 --- a/main.md +++ b/main.md @@ -61,7 +61,7 @@ STOP [CAPITALISM](capitalism.md) STOP [BLOAT](bloat.md) STOP [censorship](censor |_| |_______| |_| |_______| |_| |_______| ``` -*[Swastika](swastika.md) is a symbol of good fortune and protection from evil.* +*[Swastika](swastika.md) is a symbol of good fortune and protection from [evil](evil.md).* ## What Is Less Retarded Software/Society? diff --git a/public_domain_computer.md b/public_domain_computer.md index c732cdd..311fe7d 100644 --- a/public_domain_computer.md +++ b/public_domain_computer.md @@ -25,20 +25,24 @@ Even a pretty simple computer without an [operating system](os.md) is able to: ## Details -The project wouldn't aim to create a specific single "model" of a computer but rather blueprints that may be easily adjusted and mapped to any specific existing technology -- the goal would be to create an abstract [hardware](hardware.md) specification as well as basic [software](software.md) for the computer. +The project wouldn't aim to create a specific single "model" of a computer but rather blueprints that would be easily adjusted and mapped to any specific existing technology -- the goal would be to create an abstract [hardware](hardware.md) specification as well as basic [software](software.md) for the computer. Abstract hardware specification means e.g. description on the [logic gate](logic_gate.md) level so that the computer isn't dependent on any contemporary and potentially proprietary lower level technology such as [CMOS](cmos.md). The project would simply create a big [logic circuit](logic_circuit.md) of the computer and this description could be compiled/synthesized to a lower level circuit board description. The hardware description could also be parametrized so that certain features could be adjusted -- for example it might be possible to choose the amount of [RAM](ram.md) or disable specific CPU instructions to make a simpler, cheaper circuit board. **The computer would have to be created from the ground up**, with every design aspect following the ultimate goal. The project roadmap could look similarly to this one: -1. Design a simple [instruction set architecture](isa.md) (ISA). This isn't that hard. -2. With current [free](free_software.md) technology, e.g. [C](c.md) and [GNU](gnu.md), create custom tools for designing, simulating and testing logic gate circuits. Also not extremely difficult if we keep it simple. -3. With these tools design a simple [MCU](mcu.md) computer based on the above mentioned ISA. This is doable, there are hobbyists that have designed their own 8bit CPUs, a few collaborating people could definitely create a nice MCU if they keep it simple (no caching, no floating point, no GPUs, ...). -4. Design a simple (e.g. [FORTH](forth.md)-like) self-hosted [programming language](programming_language.md), create its compiler with support for the above mentioned ISA so that it is possible to write software for the computer. This may preceded or succeeded by adding the ISA support to an existing languages such as [C](c.md), e.g. by adding a new backed to [gcc](gcc.md). Again, pretty doable. -5. Write basic [software](software.md) for the computer. [EZ](ez.md). -6. Compile the MCU logic-level description to an actual circuitboard, possibly even with [proprietary](proprietary.md) tools if other aren't available -- this may be fixed later. -7. Manufacture the first physical computer, test it, debug it, improve it, give it to people, ... -8. Now the main goal has been touched for the first time, however the real [fun](fun.md) only begins -- now it is needed to spread the project, keep improving it, write advanced software such as an [operating system](os.md) etc. +1. Create a programming language that will be usable both as a scripting and compiled language for the computer. We already have one -- [comun](comun.md) -- though it is not fully finished yet. Now we can already start writing software for the computer. Optionally make other languages such as [C](c.md) compile to our ISA. +2. Design a simple [instruction set architecture](isa.md) (ISA). This will provide some challenge but will be doable. +3. Write basic [software](software.md) in our language, mainly: + - Custom tools for designing, simulating and testing [logic circuits](logic_citcuit.md). Not extremely difficult if we [keep it simple](kiss.md). + - [Emulator](emulator.md) of our custom ISA so that we can run and test it on our current computers. It will also be useful to make our computer possible to be run as a virtual hardware on other platforms. + - [Shell](shell.md) that will serve to performing basic tasks with the computer, e.g. using it as a calculator or interactively programming it in simple ways. The shell will also serve as a kind of [operating system](operating_system.md), or rather a simple program loader. For now the shell can run on our current computers where we can test it and fine tune it. + - Compiler -- this basically just means self hosting our compiler. + - Basic tools like a text editor, compression utility etc. +4. With the logic circuit tools design a simple [MCU](mcu.md) computer based on the above mentioned ISA. This is doable, there are hobbyists that have designed their own 8bit CPUs, a few collaborating people could definitely create a nice MCU if they keep it simple (no caching, no floating point, no GPUs, ...). +5. Compile the MCU logic-level description to an actual circuitboard, possibly even with [proprietary](proprietary.md) tools if other aren't available -- this may be fixed later. +6. Manufacture the first physical computer, test it, debug it, improve it, give it to people, ... +7. Now the main goal has been touched for the first time, however the real [fun](fun.md) only begins -- now it is needed to spread the project, keep improving it, write more software such as [games](game.md) etc. :) ## See Also