-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More quaternion methods, arrow primitive
- Loading branch information
Showing
8 changed files
with
138 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.IO; | ||
using Qkmaxware.Geometry; | ||
using Qkmaxware.Geometry.IO; | ||
using Qkmaxware.Geometry.Primitives; | ||
|
||
namespace Qkmaxware.Testing { | ||
|
||
[TestClass] | ||
public class ArrowTest : PrimitiveTest { | ||
[TestMethod] | ||
public void TestArrow() { | ||
var geom = new Arrow(1, 0.08, 8); | ||
SaveGeometry("arrow", geom); | ||
} | ||
} | ||
|
||
} |
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,37 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
|
||
namespace Qkmaxware.Geometry.Primitives { | ||
|
||
/// <summary> | ||
/// Arrow pointing in the +Z axis | ||
/// </summary> | ||
public class Arrow : Mesh { | ||
/// <summary> | ||
/// Create a new arrow with the given length | ||
/// </summary> | ||
/// <param name="length">length of the arrow</param> | ||
/// <param name="radius">radius of the arrow head</param> | ||
/// <param name="resolution">subdivision level</param> | ||
public Arrow(double length = 1, double radius = 0.08, int resolution = 8) { | ||
var innerRadius = 0.6 * radius; | ||
var lineLength = 0.8 * length; | ||
var pointLength = 0.2 * length; | ||
this.AppendRange(new Cylinder( | ||
upperRadius: innerRadius, | ||
lowerRadius: innerRadius, | ||
height: lineLength, | ||
centre: Vec3.K * (lineLength / 2), | ||
resolution: resolution | ||
)); | ||
this.AppendRange(new Cone( | ||
radius: radius, | ||
height: pointLength, | ||
centre: Vec3.K * lineLength, | ||
resolution: resolution | ||
)); | ||
} | ||
} | ||
|
||
} |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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