smile.modeling
Members list
Type members
Classlikes
An affine map of the plane, with its coefficients in the order a canvas, Java2D and SVG all take them. (x, y) goes to (a * x + c * y + e, b * x + d * y + f). That makes it setTransform(a, b, c, d, e, f) on a canvas, new AffineTransform(a, b, c, d, e, f) in Java2D and matrix(a b c d e f) in SVG.
An affine map of the plane, with its coefficients in the order a canvas, Java2D and SVG all take them. (x, y) goes to (a * x + c * y + e, b * x + d * y + f). That makes it setTransform(a, b, c, d, e, f) on a canvas, new AffineTransform(a, b, c, d, e, f) in Java2D and matrix(a b c d e f) in SVG.
Every affine is normalized when it is made, so that equal maps are equal values. Linear coefficients within smile.modeling.Affine.Tolerance times the largest of a to d of 0, 1 or -1 become exactly that, e and f are rounded to the nearest multiple of 2^-20, and -0.0 becomes 0.0. Equality is exact over the normalized values.
A public affine is always invertible and finite.
Attributes
- Companion
- object
- Source
- Affine.scala
- Supertypes
The Align singleton provides tools for describing the horizontal and vertical alignment of graphical elements.
The Align singleton provides tools for describing the horizontal and vertical alignment of graphical elements.
Attributes
- Source
- Align.scala
- Supertypes
- Self type
-
Align.type
Represents the boundaries of a rectangular area, defined by its upper left and lower right corners.
Represents the boundaries of a rectangular area, defined by its upper left and lower right corners.
Attributes
- Companion
- object
- Source
- Bounds.scala
- Supertypes
Provides factory methods for creating Bounds objects, which represent rectangular areas in a coordinate space.
Each instance of this class represents a direction on a two-dimensional plane. A direction consists of two components: dx and dy, each of which is a number between -1.0 and +1.0 (inclusive). dx indicates the degree to which the x coordinate changes when moving in that direction. dy is the same for the y coordinate. The x coordinate increases rightwards and y downwards.
Each instance of this class represents a direction on a two-dimensional plane. A direction consists of two components: dx and dy, each of which is a number between -1.0 and +1.0 (inclusive). dx indicates the degree to which the x coordinate changes when moving in that direction. dy is the same for the y coordinate. The x coordinate increases rightwards and y downwards.
For example, moving straight rightwards can be thought of as moving in a Direction with a dx of +1.0 and a dy of 0.0. The upward direction has a dx of 0.0 and a dy of -1.0. Diagonals have non-zero values for both dx and dy.
The squares of the dx and dy of any Direction always sum to roughly 1.0, except for the special value NoDirection, which represents the lack of a direction and has zero for both components. A Direction differs from a smile.modeling.Velocity, which combines a direction of movement and a speed.
You don’t instantiate Direction directly. You create Directions with the methods on this class’s companion object. Among other things, you can:
- construct a direction from two differences between coordinates, as in
Direction.fromDeltas(-100, 50), or - create a direction that corresponds to a given angle, as in
Direction.fromDegrees(60)andDirection.fromRadians(-scala.math.Pi / 4).
Some of the methods of a Direction object also create and return new Directions, as does the directionOf method on Pos objects. Moreover, this class’s companion object has a few predefined Direction constants: Up, Down, Left, Right, and NoDirection.
Direction objects are immutable.
Attributes
- Companion
- object
- Source
- Direction.scala
- Supertypes
This companion object of class `Direction` provides some constants of type Direction and methods for creating new Direction instances.
This companion object of class `Direction` provides some constants of type Direction and methods for creating new Direction instances.
Attributes
- Companion
- class
- Source
- Direction.scala
- Supertypes
- Self type
-
Direction.type
This companion object of class `Pos` provides alternative methods for creating new Pos objects.
This companion object of class `Pos` provides alternative methods for creating new Pos objects.
On the JVM, smile.modeling adds Pos(point) for a java.awt.Point as an extension on this object. import smile.modeling.* brings it into scope.
Attributes
Each instance of this class represents a location on a two-dimensional plane. A Pos object is a pair of two coordinates, x and y. Pos objects are immutable.
Each instance of this class represents a location on a two-dimensional plane. A Pos object is a pair of two coordinates, x and y. Pos objects are immutable.
Attributes
Enumerates the types of positions used in positioning and aligning elements within a graphical context.
Enumerates the types of positions used in positioning and aligning elements within a graphical context.
Attributes
- Source
- PositionType.scala
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Enum representing the four cardinal sides.
Enum representing the four cardinal sides.
Attributes
- Source
- Side.scala
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Each instance of this class represents movement in the context of a two-dimensional plane. A velocity is a combination of a smile.modeling.Direction of movement with a speed (a non-negative Double).
Each instance of this class represents movement in the context of a two-dimensional plane. A velocity is a combination of a smile.modeling.Direction of movement with a speed (a non-negative Double).
Another way to think about a Velocity is to divide it in two components: dx and dy. dx indicates the amount (and direction) of movement along the x-axis. dy is the same for the y-axis. The x coordinate increases rightwards and y downwards. For instance, a velocity with a dx of 10 and a dy of zero indicates rightward movement, and a velocity with a dx of -100 and a dy of -100 indicates faster movement leftwards and upwards.
There are many ways to create a Velocity using the methods on the companion object. Among other things, you can:
- construct a velocity from a direction and a (positive or zero) speed, as in
Velocity(Direction.Left, 50), - construct a velocity from
dxanddy, as inVelocity(-100, 50), or - determine the velocity needed to go from one smile.modeling.Pos to another in a single unit of time, as in
Velocity.between(pos1, pos2).
Many of the methods on Velocity objects also create and return new velocities.
Velocity objects are immutable.
Value parameters
- speed
-
the speed of movement, which cannot be negative
Attributes
- Companion
- object
- Source
- Velocity.scala
- Supertypes
This companion object of class `Velocity` exists primarily to provide convenience methods for creating new instances of Velocity.
This companion object of class `Velocity` exists primarily to provide convenience methods for creating new instances of Velocity.
Attributes
- Companion
- class
- Source
- Velocity.scala
- Supertypes
- Self type
-
Velocity.type
Extensions
Extensions
Constructs a smile.modeling.Pos instance from the coordinates of the given Point object. JVM only.
Constructs a smile.modeling.Pos instance from the coordinates of the given Point object. JVM only.
Attributes
- Source
- JVMPosConversions.scala
