Skip to content

Commit

Permalink
Resolved all of the remaining symbol resolution errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdiggins committed Mar 22, 2024
1 parent 8647430 commit 5374c80
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion PlatoCompiler/Symbols/TypeExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Plato.Compiler.Symbols
{
public class TypeExpression : Symbol
{
public override string Name => Definition?.Name ?? throw new Exception("Unresolved");
public override string Name => Definition?.Name ?? "_untyped_";
public TypeDefinition Definition { get; }
public IReadOnlyList<TypeExpression> TypeArgs { get; }

Expand Down
8 changes: 4 additions & 4 deletions PlatoStandardLibrary/std.angles.library.plato
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ library Angles
//==
// Complex plane trig: https://en.wikipedia.org/wiki/Trigonometric_functions#In_the_complex_plane

Sin(x: Complex): Complex
=> (x.Sin * y.Cosh, x.Cos * y.Sinh);
Sin(c: Complex): Complex
=> (c.X.Sin * c.Y.Cosh, c.X.Cos * c.Y.Sinh);

Cos(x: Complex): Complex
=> (x.Cos * y.Cosh, x.Sin * y.Sinh);
Cos(c: Complex): Complex
=> (c.X.Cos * c.Y.Cosh, c.X.Sin * c.Y.Sinh);
}
11 changes: 9 additions & 2 deletions PlatoStandardLibrary/std.geometry.concepts.plato
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ concept ImplicitVolume
inherits Geometry3D, ImplicitProcedural<Point3D>
{ }

// Any geometrical concept defined by a finite number of points
concept Points2D
inherits Geometry2D
{
Points(x: Self): Array<Point2D>;
}

// Any geometrical concept defined by a finite number of points
concept Points3D
inherits Geometry3D
Expand All @@ -232,13 +239,13 @@ concept Points3D

// https://en.wikipedia.org/wiki/B%C3%A9zier_surface
concept BezierPatch
inherits Points3D, Surface3D, Array2D<Point3D>
inherits Points3D, Surface, Array2D<Point3D>
{ }

// A grid of bezier patches
// https://en.wikipedia.org/wiki/B%C3%A9zier_surface
concept BezierSurface
inherits Points3D, Surface3D, Array2D<BicubicBezierPatch>
inherits Points3D, Surface, Array2D<BicubicBezierPatch>
{ }

// https://en.wikipedia.org/wiki/Polyhedron
Expand Down
13 changes: 6 additions & 7 deletions PlatoStandardLibrary/std.geometry.types.plato
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Point2D
}

type Line2D
implements OpenPolygon2D
implements PolygonalChain2D
{
A: Point2D;
B: Point2D;
Expand Down Expand Up @@ -147,7 +147,7 @@ type Point3D
}

type Line3D
implements OpenPolygon3D
implements PolygonalChain3D
{
A: Point3D;
B: Point3D;
Expand Down Expand Up @@ -221,10 +221,9 @@ type BicubicBezierPatch
K22: Point3D;
}


// https://en.wikipedia.org/wiki/B%C3%A9zier_curve
type CubicBezier2D
implements PointsGeometry2D
implements Points2D
{
A: Point2D;
B: Point2D;
Expand All @@ -234,7 +233,7 @@ type CubicBezier2D

// https://en.wikipedia.org/wiki/B%C3%A9zier_curve
type CubicBezier3D
implements PointsGeometry3D
implements Points3D
{
A: Point3D;
B: Point3D;
Expand All @@ -244,7 +243,7 @@ type CubicBezier3D

// https://en.wikipedia.org/wiki/B%C3%A9zier_curve
type QuadraticBezier2D
implements PointsGeometry2D
implements Points2D
{
A: Point2D;
B: Point2D;
Expand All @@ -253,7 +252,7 @@ type QuadraticBezier2D

// https://en.wikipedia.org/wiki/B%C3%A9zier_curve
type QuadraticBezier3D
implements PointsGeometry3D
implements Points3D
{
A: Point3D;
B: Point3D;
Expand Down
2 changes: 1 addition & 1 deletion PlatoStandardLibrary/std.measures.library.plato
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ library Measures
=> length.Meters / Constants.MetersPerAU;

HubbleLength(length: Length): Number
=> value.Meters / 1.HubbleLength.Meters;
=> length.Meters / 1.HubbleLength.Meters;
}

5 changes: 4 additions & 1 deletion PlatoStandardLibrary/std.numerics.library.plato
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ library Numerical
=> (x-y).Abs <= x.MultiplyEpsilon(y);

AlmostZero(x: Number): Boolean
=> x.Abs < Epsilon;
=> x.Abs < Epsilon;

AlmostZeroOrOne(x: Number): Boolean
=> AlmostEqual(x, 0) || AlmostEqual(x, 1);

Lerp(a: ScalarArithmetic, b: ScalarArithmetic, t: Number): ScalarArithmetic
=> a * t.FromOne + b * t;
Expand Down
12 changes: 12 additions & 0 deletions PlatoStandardLibrary/std.types.plato
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,18 @@ type NumberInterval
Max: Number;
}

// Affine 2D transformation matrix
// https://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations
type Matrix2D
implements Value, Vector
{
Column1: Vector3D;
Column2: Vector3D;
Column3: Vector3D;
}

// Affine 3D transformation matrix
// https://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations
// https://mindcontrol.org/~hplus/graphics/matrix-layout.html
// Column major layout in memory
// Translation component is in Column4.XYZ
Expand Down

0 comments on commit 5374c80

Please sign in to comment.