GeometryHelper.CommonGeometry
4.0.0
merge project
dotnet add package GeometryHelper.CommonGeometry --version 4.0.0
NuGet\Install-Package GeometryHelper.CommonGeometry -Version 4.0.0
<PackageReference Include="GeometryHelper.CommonGeometry" Version="4.0.0" />
<PackageVersion Include="GeometryHelper.CommonGeometry" Version="4.0.0" />
<PackageReference Include="GeometryHelper.CommonGeometry" />
paket add GeometryHelper.CommonGeometry --version 4.0.0
#r "nuget: GeometryHelper.CommonGeometry, 4.0.0"
#:package GeometryHelper.CommonGeometry@4.0.0
#addin nuget:?package=GeometryHelper.CommonGeometry&version=4.0.0
#tool nuget:?package=GeometryHelper.CommonGeometry&version=4.0.0
GeometryHelper.CommonGeometry
The types that GeometryHelper.PlaneGeometry and
GeometryHelper.SolidGeometry both need. It exists so that a
program using the two libraries together sees one Tolerance and one Angle rather than two of
each, which is what happens when a shared type is copied into both.
It depends on nothing and knows nothing about either library.
Installation
dotnet add package GeometryHelper.CommonGeometry
Both geometry libraries pull it in on their own, so install it directly only when you want Tolerance
or Angle without either of them.
Tolerance
Every comparison in either library that can be affected by floating point error takes a Tolerance,
and every such method has an overload without one that reads Tolerance.Global. Neither library
compares coordinates with ==.
| Threshold | Default | Measures |
|---|---|---|
EqualPoint |
1E-4 |
Distance below which two points are the same point. |
EqualVector |
1E-4 |
Difference below which two vectors are the same vector. |
EqualAngleRad |
1° | Angular difference for parallel and perpendicular tests. |
EqualPlanar |
1E-4 |
Distance from a plane below which a point counts as lying on it. |
EqualPlanar is separate from EqualPoint because coplanarity is measured far from the reference
point. A face twelve metres long that is tilted by a hundredth of a degree deviates by about two
millimetres at its far end — far more than EqualPoint allows, yet still flat enough to work with.
Only GeometryHelper.SolidGeometry uses it.
// One setting for both libraries.
Tolerance.Global = new Tolerance(equalPoint: 1E-3, equalVector: 1E-3);
// Or pass one explicitly, which is what to do when a single operation needs to be looser or
// tighter than the rest of the program.
bool same = first.IsEqualTo(second, new Tolerance(1E-6, 1E-6));
Tolerance.Global is a single shared setting. Changing it for a drawing in the plane changes it for
a model in space as well.
Angle
An angle stored in radians and readable as either unit. There is deliberately no public constructor taking a bare double: a number on its own does not say which unit it is in, so the unit is named at the point of creation.
Angle right = Angle.FromDegrees(90.0);
double radians = right.Radians; // 1.5707963...
Angle turned = right + Angle.FromDegrees(300.0);
Angle wrapped = turned.Normalize(); // into [0, 2π)
Angle signed = turned.NormalizeSigned(); // into (-π, π]
Normalize and NormalizeSigned differ in where they put the cut: the first is what to use for a
bearing, the second for a difference between two directions, where -170° is a nearer answer than
190°.
PointLocation
Where a point sits relative to a shape: Inside, OutSide, or OnSide.
What counts as Inside depends on the family the shape belongs to. A volume encloses a region of
space. A region encloses an area — in space that means a point counts as inside only when it lies on
the carrier plane as well as within the boundary. A curve encloses nothing and never reports
Inside.
PlaneSide
Which side of an oriented plane a point lies on: Above, Below, or On. The sides are named after
the plane normal rather than after world up, because a plane carries its own orientation and may
point anywhere.
Licence
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|
The types that GeometryHelper.PlaneGeometry and GeometryHelper.SolidGeometry both need, kept in
one package so a program using the two together sees one Tolerance and one Angle rather than two
of each.
- Tolerance carries four thresholds: EqualPoint, EqualVector, EqualAngleRad and EqualPlanar. The
last is separate because coplanarity is measured far from the reference point, where a
hundredth of a degree of tilt becomes a deviation the point threshold would not tolerate. The
plane library leaves it unused.
- Tolerance.Global is one setting shared by both geometry libraries rather than one each. It is
unsynchronized process-wide state: set it once while starting up and read it thereafter, and
pass a Tolerance explicitly where it has to vary per drawing, per model or per thread. New in
3.1.0 is that this is written down; the behaviour is unchanged.
- Angle stores radians and has no public constructor taking a bare double, because a number on
its own does not say which unit it is in: use FromRadians or FromDegrees.
- PointLocation and PlaneSide say where a point sits relative to a shape and relative to an
oriented plane.
- This package depends on nothing and knows nothing about either geometry library.