-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
349 changed files
with
17,916 additions
and
5,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,14 @@ jobs: | |
runs-on: windows-2019 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 10 | ||
token: ${{ secrets.HYPAR_GITHUB_BOT_PAT }} | ||
- name: Setup Git | ||
run: | | ||
git config user.name "hypar-eric-bot" | ||
git config user.email "[email protected]" | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
|
@@ -24,11 +29,7 @@ jobs: | |
dotnet test --filter Category=Examples | ||
docfx ./doc/docfx.json -f | ||
- name: Deploy Docs | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: us-west-1 | ||
run: | | ||
aws s3 sync ./docs s3://${{ secrets.AWS_BUCKET }} --delete --exclude '*.js' | ||
aws s3 sync ./docs s3://${{ secrets.AWS_BUCKET }} --delete --exclude '*' --include '*.js' --content-type 'text/javascript' | ||
aws cloudfront create-invalidation --distribution-id E2PS0S8A6ZSOKE --paths "/*" | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'docs' | ||
message: 'Update documentation' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using BenchmarkDotNet.Attributes; | ||
using Elements.Geometry; | ||
|
||
namespace Elements.Benchmarks | ||
{ | ||
public class MeshRayIntersection | ||
{ | ||
private Mesh _mesh; | ||
private List<Ray> _rays; | ||
|
||
public MeshRayIntersection() | ||
{ | ||
var random = new Random(10); | ||
_mesh = new Mesh(); | ||
_rays = new List<Ray>(); | ||
var xCount = 100; | ||
var yCount = 300; | ||
MeshConstruction.BuildRandomMesh(_mesh, random, xCount, yCount); | ||
|
||
// create 1000 random rays | ||
for (int i = 0; i < 1000; i++) | ||
{ | ||
var ray = new Ray(new Vector3(random.NextDouble() * xCount, random.NextDouble() * yCount, 2.1), new Vector3(random.NextDouble() * 2 - 1, random.NextDouble() * 2 - 1, -1)); | ||
_rays.Add(ray); | ||
} | ||
} | ||
|
||
|
||
[Benchmark(Description = "Intersect 1000 rays with mesh.")] | ||
public void IntersectRays() | ||
{ | ||
foreach (var ray in _rays) | ||
{ | ||
ray.Intersects(_mesh, out var _); | ||
} | ||
} | ||
} | ||
public class MeshConstruction | ||
{ | ||
public static void BuildRandomMesh(Mesh m, Random random, int xCount, int yCount) | ||
{ | ||
for (int i = 0; i < xCount; i++) | ||
{ | ||
for (int j = 0; j < yCount; j++) | ||
{ | ||
var point = new Vector3(i, j, random.NextDouble() * 2); | ||
var c = m.AddVertex(point); | ||
if (i != 0 && j != 0) | ||
{ | ||
// add faces | ||
var d = m.Vertices[i * yCount + j - 1]; | ||
var a = m.Vertices[(i - 1) * yCount + j - 1]; | ||
var b = m.Vertices[(i - 1) * yCount + j]; | ||
m.AddTriangle(a, b, c); | ||
m.AddTriangle(c, d, a); | ||
} | ||
} | ||
} | ||
} | ||
|
||
[Params(1000, 5000, 10000, 30000)] | ||
public int VertexCount { get; set; } | ||
|
||
[Benchmark(Description = "Construct Mesh")] | ||
public void ConstructMesh() | ||
{ | ||
var mesh = new Mesh(); | ||
BuildRandomMesh(mesh, new Random(10), 100, VertexCount / 100); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Elements.Geometry; | ||
using Newtonsoft.Json; | ||
|
||
namespace Elements.Annotations | ||
{ | ||
/// <summary>An element that stores warning messages.</summary> | ||
[JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] | ||
// TODO: We probably don't want to inherit from GeometricElement for ever. It would be better for Messages to | ||
// behave more like actual Annotation elements while still being capable of having an appearance in 3D in some circumstances. | ||
public partial class Message : GeometricElement | ||
{ | ||
/// <summary> | ||
/// Default json constructor for a message that may have geometry. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="stackTrace"></param> | ||
/// <param name="severity"></param> | ||
/// <param name="transform"></param> | ||
/// <param name="material"></param> | ||
/// <param name="representation"></param> | ||
/// <param name="isElementDefinition"></param> | ||
/// <param name="id"></param> | ||
/// <param name="name"></param> | ||
[JsonConstructor] | ||
public Message(string @message, string @stackTrace, MessageSeverity @severity, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null) | ||
: base(transform, material, representation, isElementDefinition, id, name) | ||
{ | ||
this.MessageText = @message; | ||
this.StackTrace = @stackTrace; | ||
this.Severity = @severity; | ||
} | ||
|
||
/// <summary> | ||
/// Empty constructor. | ||
/// </summary> | ||
public Message() | ||
: base() | ||
{ | ||
} | ||
|
||
/// <summary>A warning message for the user.</summary> | ||
[JsonProperty("Message", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] | ||
public string MessageText { get; set; } | ||
|
||
/// <summary>Developer specific message about the failure in the code.</summary> | ||
[JsonProperty("Stack Trace", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] | ||
public string StackTrace { get; set; } | ||
|
||
/// <summary>Developer specific message about the failure in the code.</summary> | ||
[JsonProperty("Severity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] | ||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] | ||
public MessageSeverity Severity { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace Elements.Annotations | ||
{ | ||
/// <summary> | ||
/// The severity of a given message. | ||
/// </summary> | ||
public enum MessageSeverity | ||
{ | ||
/// <summary> | ||
/// Message is for information purposes only. | ||
/// </summary> | ||
Info, | ||
|
||
/// <summary> | ||
/// Message is for a warning. | ||
/// </summary> | ||
Warning, | ||
|
||
/// <summary> | ||
/// Message is for an error. | ||
/// </summary> | ||
Error | ||
}; | ||
} |
Oops, something went wrong.