CG Foundation & Basics

Essentials

Dimensions

In 3D graphics, objects are located in a three-dimensional Cartesian coordinate system. The coordinates (X, Y, Z) define the position of a point or vertex in 3D space. The origin (0, 0, 0) is typically the reference point.

To locate a point in 3D space, you use coordinates. A coordinate is a set of three values (X, Y, Z) that specify a point's position relative to the origin. For example, (3, 2, 1) represents a point located 3 units to the right (X), 2 units upward (Y), and 1 unit forward (Z) from the origin.


Certainly! Let's break down 2D (two-dimensional) and 3D (three-dimensional) in very simple terms:

2D (Two-Dimensional):

  • Imagine a flat piece of paper or a computer screen. It has two dimensions: width and height.
  • In a 2D world, everything exists on this flat surface. You can draw shapes, like circles or squares, and they have length and width, but they don't have depth or thickness.
  • Think of 2D as being like drawings or pictures in a coloring book—they're flat and have no depth.

3D (Three-Dimensional):

  • In the real world, we live in a 3D space. This means things not only have width and height but also depth.
  • Think about objects you can hold in your hand, like a cube or a ball. They have length, width, and depth. That's 3D.
  • In a 3D world, you can move around and see things from different angles. It's like the difference between looking at a photo of a soccer ball and holding a real soccer ball in your hand.

In summary, 2D is flat like a drawing, while 3D adds depth, like the real world around us. 2D is like what you see on paper or a screen, while 3D is what you experience in the physical world with depth and volume.


Understanding the data

Primitive Data Types:

Primitive data types are the basic building blocks of data in programming languages. Common primitive data types include:

Integer (int):

Represents whole numbers (e.g., -5, 0, 42).

Floating-Point (float or double):

Represents numbers with decimal points (e.g., 3.14, -0.005).

Character (char):

Represents single characters (e.g., 'A', 'x', '$').

Boolean (bool):

Represents true or false values.

Composite Data Types:

Composite data types are made up of multiple primitive or other composite data types. Common composite data types include:

Array:

An ordered collection of elements of the same data type (e.g., an array of integers or characters). Typically have a fixed or static size, which means that you must specify the size of the array when it is declared. Once the size is set, it cannot be changed without creating a new array. Arrays are used to store and manipulate lists of data. Elements in an array are accessed by their index. Example: [1, 2, 3, 4, 5].


String:

A sequence of characters. Represents a sequence of characters. Strings are used for text processing and manipulation. Examples: "Hello, World!", "12345".

Lists:

Often have a dynamic size, which means they can grow or shrink as needed. You can add or remove elements from a list without specifying its size in advance. A dynamic data structure that can grow or shrink in size as needed. Lists are often used when the number of elements is not known in advance. Examples: [1, 2, 3], ["apple", "banana", "cherry"].

Vector:

A one-dimensional array that represents a mathematical vector, often used in physics and computer graphics for geometric operations. Example: [3.0, -1.5, 2.5].

Matrix:

A two-dimensional array of elements, often used in mathematics and scientific computing for operations like matrix multiplication and linear algebra. Example:

csharpCopy code

[ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]

Dictionary (dict, map, or hash):

Represents a collection of key-value pairs, allowing efficient lookups by keys. Each key is associated with a value. Example: {"name": "John", "age": 30}.

Tuple:

An ordered, immutable collection of elements. Tuples are used when the order and structure of the data are important and should not change. Example: (1, "apple", 3.14).

Struct or Record:

A user-defined data type that allows grouping together multiple variables of different data types under a single name or structure. Structs are used for organizing related data. Example (in C++):

cppCopy code

struct Person { string name; int age; };

Class or Object: In object-oriented programming (OOP), classes define blueprints for creating objects. Objects encapsulate both data (attributes) and behavior (methods). Classes and objects are used for modeling real-world entities. Example (in Python):

pythonCopy code

class Person: def __init__(self, name, age): self.name = name self.age = age


Programming first principles

Programming Concepts

Variable:

A variable is like a container that holds data or values in a program. It has a name and can store different types of information like numbers, text, or objects. For example, x could be a variable storing the number 5.

Constant:

A constant is similar to a variable, but its value doesn't change once it's set. Constants are often used for values that should remain fixed throughout the program. For instance, PI could be a constant with the value 3.14159.

Function:

A function is like a mini-program within a program. It's a set of instructions that can be called to perform a specific task. Functions take inputs (called parameters) and can produce outputs. For example, a calculateSum function might take two numbers and return their sum when called.

Statement:

A statement is a single line of code that performs an action in a program. Statements can include assignments (e.g., x = 5;), function calls (e.g., print("Hello");), and more.

Expression:

An expression is a combination of values, variables, and operators that can be evaluated to produce a result. For example, 2 + 3 is an expression that evaluates to 5.

Conditional Statement:

A conditional statement (or if statement) is used to make decisions in a program. It checks a condition and executes different code blocks based on whether the condition is true or false. For example, if (x > 10) checks if x is greater than 10.

Loop:

A loop is a control structure that repeats a block of code multiple times. It's used for tasks that need to be done repeatedly, like processing items in a list or running a game loop.


Other terms


Id

Keys



Computing Basics

Processor

Memory

GPU

Database

Files & folders

File Size

Farms

Scripts

Pipeline & Workflows

Image compression

Computing Basics

Processor

Memory

GPU

Database

Files & folders

File Size

Farms

Scripts

Pipeline & Workflows

Image compression

End of lesson