ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
#Python
Attribute versus Property
An attribute with a __get__, __set__, or __delete__ method is a property.

Properties
Are created by putting the @property decorator above a method defenition. This means that when the instance attribute with the same name as the method is accessed, the method will be called instead.
#Python
Classes
A class is a new type of object which can have instances.

An instance has:
• Attributes — for maintaining its state, defined by its constructor
• Methods — for modifying its state, defined by its class

🔥 Methods are actually attributes. More specifically, class attributes.

Definition
class ClassName:
classAttribute = value
def __init__(self, a):
self.a = a


⚠️ All methods must have self as their first parameter.
⚠️ Instances inherit class attributes upon construction.

Instantiation
x = ClassName(a)

⚠️ Classes are created at runtime and can be modified after creation.

Terminology
• base class = parent class
• derived class = child class
• derive = inherit
• attribute = data member
• method = function member


Inheritance
• Multiple base classes are allowed.
• The derived class can override any methods of its base classes. i.e. all member functions are virtual and can be overridden.

class Pizza(Food):

Polymorphism
• A method can call the method of a base class with the same name.

Incapsulation
• members are normally public except Private Variables
The Jack human simulation system
Conceived as an ergonomic assessment and virtual human prototyping system, Jack was developed at the University of Pennsylvania in the 80s & 90s for for #NASA. It soon gathered funding from the U.S. Navy, U.S. Army, U.S. Air Force and other government and corporate users for their own applications.
#ergonomics

In 1996 the software was split off as a separate private company and is now sold by #Siemens as an ergonomic human simulation toolkit called Tecnomatix Jack.

H-Anim (Humanoid Animation)
An ISO standard for humanoid modeling and animation, H-Anim defines a specification for defining interchangeable human figures so that those characters can be used across a variety of 3D games and simulation environments.

Developed in the late 1990s, it was significantly influenced by the Jack human modeling.
#animation #graphics #ergonomics #gameIndustry

Inverse kinematics
Is the mathematical process of recovering the movements of an object in the world from some data such as films of those movements or films of the world seen from a camera making those movements.
#robotics #animation

The roots of most modern human animation inverse kinematics systems, including those integrated with #Autodesk's 3ds max and #Maya, can be traced to the research and development done for the Jack system.
#GML #graphics
Textured primitives

Acquiring textures
sprite_get_texture(spr, subimg) and background_get_texture(back) return the ID of a texture.

⚠️ Resource dimensions must be powers of 2.

Loading
This is usually done automatically but:
texture_preload(texid) puts the texture into the video memory immediately.

Drawing
draw_primitive_begin_texture(kind, texid)
draw_vertex_texture(x, y, xtex, ytex)
draw_primitive_end()

⚠️ xtex and ytex normally lie between 0 and 1 but larger values are also used, leading to a repetition of the texture.
⚠️ texture_get_width(texid) and texture_get_height(texid) return a value in the range of 0~1.

Repetition
texture_set_repeat(boolean)
• Whether to repeat the texture.
• Note that sprites and backgrounds are always drawn without repeating. So once you draw a sprite or background this value will be set to false.
• Default is false.

Linear interpolation
texture_set_interpolation(boolean)
• Whether to use linear interpolation (smoother but blurry and expensive) or pick the nearest pixel.
• Also affects the drawing of sprites and backgrounds.
• Can also be changed in the global game settings.
• Default is false.

Blending
texture_set_blending(blend)
• Whether to use blending with colors and alpha values.
false might be faster on old hardware.
• Also affects the drawing of sprites and backgrounds.
• Default is true.
#Geometry
Point in polygon
The point-in-polygon problem asks whether a given point in the plane lies inside, outside, or on the boundary of a polygon.

Ray casting algorithm
One simple way is to test how many times a ray, starting from the point and going in any fixed direction, intersects the edges of the polygon.

Even : outside
Odd : inside

⚠️ This method won't work if the point is on the edge of the polygon.

Most implementations of the ray casting algorithm consecutively check intersections of a ray with all sides of the polygon in turn.

A problem
If the ray passes exactly through a vertex of a polygon, then it will intersect 2 segments at their endpoints.

Solution: Count only if the second vertex of the side lies below the ray.
“Space games explode into a new dimension.”
— Zaxxon, the first #isometric game, 1982
Progress is dramatic.
#graphics #textures #3D
UV mapping
• Projecting a 2D texture onto a 3D model's surface.
• U and V denote the axes of the 2D texture.
• Unlike projection mapping, only maps into a screen space rather than into the geometric space of the object. But the rendering computation uses the UV texture coordinates to determine how to paint the three-dimensional surface.

Affine texture mapping
• Used by #GML.
• The cheapest algorithm to linearly interpolate texture coordinates across a surface.
• Does not take the depth of a vertices into account, therefore the polygon is not perspective correct.
• Works correctly for #isometric graphics.

Inverse-texture mapping
• Projects 3D vertices onto the screen during rendering and linearly interpolates the texture coordinates in screen space between them.
• Done by incrementing fixed point UV coordinates or by an incremental error algorithm akin to Bresenham's line algorithm.

Screen space
The coordinate space of the resulting 2D image during 3D rendering. The result of 3D projection on geometry in camera space.
Perspective correctness
#Nile
Guidelines
Whitespace means nothing.
World Creator v1.5 Freeware
Inet2Inet.com

Create your own stylised Textures.
Create Animation's.
Superimpose one texture on another.
Use Bump Maps.
Replace a selected range of colours with another.
Shade / Shadow effects.
Use 2 Texture Libraries and a Mask Library Simultaeneously
Create & Import user Tutorials (share files with other users).
Mix Solid Colours and Textures togetherCreate Cartoon or realistic style graphics.
Use the new Mask Packs now available.
Batch Textures (create hundreds of tiles with 1 mouse click).
Offset one Texture in relationship to another Texture.
Create your own Masks to suit your needs very simply.
Flip, Rotate, Tile Textures.
Create ISOMETRIC Tiles.
Create PSEUDO 3D Tiles.
Create 2D PLATFORM Tiles.
#Nile
Guidelines
Never have keywords.
#Nile
Guidelines
Formulate problems intuitively then recognize patterns.
Tokenizing
Breaking up the program into a list of strings that are independent tokens.
e.g. int a = 5[int] [a] [=] [5]

Lexing
Iterating over that list and converting the tokens into strong types.
e.g. [int] [a] [=] [5][type] [identifier] [assignment] [integerLiteral]
Parser is responsible for creating abstract syntax trees and logical validation of the code. The parser uses a stream of tokens.
“The beginning of wisdom is to call things by their proper name.”
— Chinese proverb
All data structures are trees. 🗃
Correctness
Correctness of an algorithm is asserted when it is said that the algorithm is correct with respect to a specification. Functional correctness refers to the input-output behaviour of the algorithm i.e., for each input it produces the expected output.

Partial versus Total correctness
An algorithm is partially correct if an answer is returned; it is totally correct if it terminates i.e., halts.

Halting problem
The problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running i.e., halt or continue to run forever.

#Alan_Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist. A key part of the proof was a mathematical definition of a computer and program, which became known as a #Turing_machine; the halting problem is undecidable over Turing machines. It is one of the first examples of a decision problem.
Never go to sea with two chronometers;

take one or three.