Varset class
To define a varset.
Varset means variable set in graphics algebra. Varsets, connected with operators, create an algebra expression.
The algebra specifies how variable sets construct the plane frame, such as how they are assigned to dimensions and how tuples are grouped.
There are three operators in graphics algebra:
-
*, called cross, which assigns varsets to different dimensions (Usually x and y) in order.
-
+, called blend, which assigns varsets to a same dimension in order. The meaning of the variables respectively in that dimension is determined by geometry type.
-
/, called nest, which groups all tuples by the right varset. Grouping is used for faceting, collision modifiers, or seperating lines or areas. The nesting variables should be discrete.
For example:
A name
variable for x and a score
varable for y:
Varset('name') * Varset('score')
A date
variable for x, and y is a bar between minimum price (variable min
)
and maximum price (variable max
):
Varset('date') * (Varset('min') + Varset('max'))
A line chart of sales
in every day
, but different category
s in different
lines:
Varset('day') * Varset('sales') / Varset('category')
The operators are associative and distributive, but not commutative (Because the assigning is in order):
Varset('x') * Varset('y') * Varset('z') == Varset('x') * (Varset('y') * Varset('z'))
Varset('x') + Varset('y') + Varset('z') == Varset('x') + (Varset('y') + Varset('z'))
Varset('x') / Varset('y') / Varset('z') == Varset('x') / (Varset('y') / Varset('z'))
Varset('x') * (Varset('y') + Varset('z')) == Varset('x') * Varset('y') + Varset('x') * Varset('z')
(Varset('x') + Varset('y')) * Varset('z') == Varset('x') * Varset('z') + Varset('y') * Varset('z')
Varset('x') / (Varset('y') + Varset('z')) == Varset('x') / Varset('y') + Varset('x') / Varset('z')
(Varset('x') + Varset('y')) / Varset('z') == Varset('x') / Varset('z') + Varset('y') / Varset('z')
Varset('x') * Varset('y') != Varset('y') * Varset('x')
Varset('x') + Varset('y') != Varset('y') + Varset('x')
Varset('x') / Varset('y') != Varset('y') / Varset('x')
Return type of the two operators is also Varset, thus a whole algebra expression is also Varset type.
Note that this algebra is derived from the Grammer of Graphics. For easy understanding, explainations above are not strict definitions.
Constructors
- Varset(String tag)
- Creates a varset with the variable name.
- Varset.unity()
- Creates a unity varset.
Properties
- form → AlgForm
-
The numerator part of the algebra expression.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- nested → AlgForm?
-
The nested part.
final
-
nesters
→ List<
AlgForm> -
The nesters.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator *(
Varset other) → Varset - The cross operator.
-
operator +(
Varset other) → Varset - The blend operator.
-
operator /(
Varset other) → Varset - The nest operator.
-
operator ==(
Object other) → bool -
The equality operator.
override