Skip to content

Commit 93d0bbc

Browse files
committed
fix typos with Claude
1 parent 0ace4c7 commit 93d0bbc

File tree

16 files changed

+283
-278
lines changed

16 files changed

+283
-278
lines changed

CHANGELOG.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.13.0] - 2026-01-17
11+
### Changed
12+
- Referencing [Rhino.Scripting 0.13.0](https://github.com/goswinr/Rhino.Scripting/blob/main/CHANGELOG.md#0130)
13+
### Fixed
14+
- Many typos in documentation(thank you Claude!)
1015

11-
## [0.12.1] - 2025-5-28
16+
## [0.12.1] - 2025-05-28
1217
### Changed
1318
- Referencing [Rhino.Scripting 0.12.0](https://github.com/goswinr/Rhino.Scripting/blob/main/CHANGELOG.md#0120)
1419

15-
## [0.11.0] - 2025-5-25
20+
## [0.11.0] - 2025-05-25
1621
### Changed
1722
- Referencing Rhino.Scripting 0.11.0
1823
### Added
@@ -53,7 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5358
- First public release
5459
- Referencing Rhino.Scripting 0.5.0
5560

56-
[Unreleased]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.12.1...HEAD
61+
[Unreleased]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.13.0...HEAD
62+
[0.13.0]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.12.1...0.13.0
5763
[0.12.1]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.11.0...0.12.1
5864
[0.11.0]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.10.2...0.11.0
5965
[0.10.2]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.10.1...0.10.2
@@ -64,10 +70,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6470
[0.8.0]: https://github.com/goswinr/Rhino.Scripting.FSharp/compare/0.5.0...0.8.0
6571
[0.5.0]: https://github.com/goswinr/Rhino.Scripting.FSharp/releases/tag/0.5.0
6672

67-
68-
69-
<!--
70-
use to get tag dates:
71-
git log --tags --simplify-by-decoration --pretty="format:%ci %d"
72-
73-
-->

Rhino.Scripting.Fsharp.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
<PackageReference Include="FSharp.Core" Version="6.0.7" /> <!-- so that dependabot does not fail, even though it is set to be excluded -->
6161

6262
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
63-
<PackageReference Include="Ionide.KeepAChangelog.Tasks" Version="0.1.8" PrivateAssets="all" />
63+
<PackageReference Include="Ionide.KeepAChangelog.Tasks" Version="0.3.1" PrivateAssets="all" />
6464

6565
<PackageReference Include="RhinoCommon" Version="7.0.20314.3001" Condition="'$(TargetFramework)' == 'net48'" PrivateAssets="all" ExcludeAssets="runtime" /> <!--should be the same version as Rhino.Scripting and Rhino.Scripting.Extension -->
6666
<PackageReference Include="RhinoCommon" Version="8.19.25132.1001" Condition="'$(TargetFramework)' == 'net7.0'" PrivateAssets="all" ExcludeAssets="runtime" /><!--should be the same version as Rhino.Scripting and Rhino.Scripting.Extension -->
67-
<PackageReference Include="Rhino.Scripting" Version="0.12.1" />
67+
<PackageReference Include="Rhino.Scripting" Version="0.13.0" />
6868
<!-- <Reference Include="Rhino.Scripting" HintPath="../Rhino.Scripting/bin/Release/net48/Rhino.Scripting.dll" /> -->
6969
</ItemGroup>
7070

Src/Line.fs

Lines changed: 39 additions & 39 deletions
Large diffs are not rendered by default.

Src/Plane.fs

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,29 @@ module AutoOpenPlane=
2727
let v = pt-pl.Origin
2828
pl.XAxis * v, pl.YAxis * v, pl.ZAxis * v
2929

30-
/// First finds the closet point on plane from a test point.
30+
/// First finds the closest point on plane from a test point.
3131
/// Then returns a new plane with Origin at this point and the same Axes vectors.
3232
member inline pl.PlaneAtClPt pt =
3333
let o = pl.ClosestPoint pt
3434
Plane(o, pl.XAxis, pl.YAxis)
3535

36-
/// Returns the angle to another Plane in Degree, ignoring the normal's orientation.
37-
/// So 0.0 if the planes are parallel. And 90 degrees if the planes are perpendicular to ech other.
36+
/// Returns the angle to another Plane in Degrees, ignoring the normal's orientation.
37+
/// So 0.0 if the planes are parallel. And 90 degrees if the planes are perpendicular to each other.
3838
member inline this.Angle90ToPlane (pl:Plane) =
3939
Vector3d.angle90 this.ZAxis pl.ZAxis
4040

41-
/// Returns the angle to 3D vector in Degree, ignoring the plane's orientation.
42-
/// So 0.0 if the vector is parallele to the Plane. And 90 degrees if the vector is perpendicular to the plane.
41+
/// Returns the angle to a 3D vector in Degrees, ignoring the plane's orientation.
42+
/// So 0.0 if the vector is parallel to the Plane. And 90 degrees if the vector is perpendicular to the plane.
43+
/// Fails if the vector is too short (IsZeroLength shorter than 1e-12).
4344
member inline pl.Angle90ToVec (v:Vector3d) =
44-
90.0 - Vector3d.angle90 v.Unitized pl.ZAxis
45+
let len = v.Length
46+
if isTooTiny len then RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:.Plane.Angle90ToVec: Vector is too short: %O" v
47+
let u = Vector3d(v.X/len, v.Y/len, v.Z/len)
48+
90.0 - Vector3d.angle90 u pl.ZAxis
4549

4650

47-
/// Returns the angle to a Line in Degree, ignoring the ZAxis's orientation.
48-
/// So 0.0 if the line is parallele to the Plane. And 90 degrees if the line is perpendicular to the plane.
51+
/// Returns the angle to a Line in Degrees, ignoring the ZAxis's orientation.
52+
/// So 0.0 if the line is parallel to the Plane. And 90 degrees if the line is perpendicular to the plane.
4953
member inline pl.Angle90ToLine (ln:Line) =
5054
let x = ln.ToX-ln.FromX
5155
let y = ln.ToY-ln.FromY
@@ -61,67 +65,55 @@ module AutoOpenPlane=
6165
/// Evaluate at 2D parameter (Z parameter = 0.0)
6266
member inline p.EvaluateAtXY (px:float, py:float) = p.Origin + p.XAxis*px + p.YAxis*py
6367

64-
/// Checks if two PPlanes are coincident within the distance tolerance. 1e-6 by default.
68+
/// Checks if two Planes are coincident within the distance tolerance. 1e-6 by default.
6569
/// This means that their Z-axes are parallel within the angle tolerance
6670
/// and the distance of second origin to the first plane is less than the distance tolerance.
6771
/// The default angle tolerance is 0.25 degrees.
68-
/// This tolerance can be customized by an optional minium cosine value.
72+
/// This tolerance can be customized by an optional minimum cosine value.
6973
/// See Rhino.Scripting.FSharp:.Cosine module.
7074
member inline pl.IsCoincidentTo (other:Plane,
7175
[<OPT;DEF(1e-6)>] distanceTolerance:float,
7276
[<OPT;DEF(Cosine.``0.25``)>] minCosine:float<Cosine.cosine>) =
7377
pl.ZAxis.IsParallelTo(other.ZAxis, minCosine)
7478
&&
75-
pl.DistanceToPt other.Origin < distanceTolerance
79+
abs(pl.DistanceToPt other.Origin) < distanceTolerance
7680

7781

78-
/// Return a new plane with given Origin
82+
/// Return a new plane with given Origin.
83+
[<Obsolete("Use Plane.setOrigin instead")>]
7984
static member inline setOrig (pt:Point3d) (pl:Plane) =
80-
let mutable p = pl.Clone()
81-
p.Origin <- pt
82-
p
85+
Plane(pt, pl.XAxis, pl.YAxis)
8386

8487
/// Return a new plane with given Origin X value changed.
88+
[<Obsolete("Use Plane.setOriginX instead")>]
8589
static member inline setOrigX (x:float) (pl:Plane) =
86-
let mutable p = pl.Clone()
87-
p.OriginX <- x
88-
p
90+
Plane(pl.Origin |> Point3d.withX x, pl.XAxis, pl.YAxis)
8991

9092
/// Return a new plane with given Origin Y value changed.
93+
[<Obsolete("Use Plane.setOriginY instead")>]
9194
static member inline setOrigY (y:float) (pl:Plane) =
92-
let mutable p = pl.Clone()
93-
p.OriginY <- y
94-
p
95+
Plane(pl.Origin |> Point3d.withY y, pl.XAxis, pl.YAxis)
9596

9697
/// Return a new plane with given Origin Z value changed.
98+
[<Obsolete("Use Plane.setOriginZ instead")>]
9799
static member inline setOrigZ (z:float) (pl:Plane) =
98-
let mutable p = pl.Clone()
99-
p.OriginZ <- z
100-
p
100+
Plane(pl.Origin |> Point3d.withZ z, pl.XAxis, pl.YAxis)
101101

102102
/// Return a new plane with Origin translated by Vector3d.
103103
static member inline translateBy (v:Vector3d) (pl:Plane) =
104-
let mutable p = pl.Clone()
105-
p.Origin <- p.Origin + v
106-
p
104+
Plane(pl.Origin + v, pl.XAxis, pl.YAxis)
107105

108106
/// Return a new plane with Origin translated in World X direction.
109107
static member inline translateByWorldX (x:float) (pl:Plane) =
110-
let mutable p = pl.Clone()
111-
p.OriginX <- p.OriginX + x
112-
p
108+
Plane(pl.Origin |> Point3d.moveX x, pl.XAxis, pl.YAxis)
113109

114110
/// Return a new plane with Origin translated in World Y direction.
115111
static member inline translateByWorldY (y:float) (pl:Plane) =
116-
let mutable p = pl.Clone()
117-
p.OriginY <- p.OriginY + y
118-
p
112+
Plane(pl.Origin |> Point3d.moveY y, pl.XAxis, pl.YAxis)
119113

120114
/// Return a new plane with Origin translated in World Z direction.
121115
static member inline translateByWorldZ (z:float) (pl:Plane) =
122-
let mutable p = pl.Clone()
123-
p.OriginZ <- p.OriginZ + z
124-
p
116+
Plane(pl.Origin |> Point3d.moveZ z, pl.XAxis, pl.YAxis)
125117

126118

127119
/// Rotate about Z axis by angle in degree.
@@ -155,7 +147,7 @@ module AutoOpenPlane=
155147
//abs (a.ZAxis.Z - b.ZAxis.Z) <= tol
156148

157149

158-
/// Checks if two 3D Parametrized Planes are coincident within the distance tolerance..
150+
/// Checks if two 3D Parametrized Planes are coincident within the distance tolerance.
159151
/// This means that the Z-axes are parallel within 0.25 degrees
160152
/// and the distance of second origin to the first plane is less than the tolerance.
161153
static member inline areCoincident tol (a:Plane) (b:Plane) =
@@ -229,8 +221,8 @@ module AutoOpenPlane=
229221
Plane(Point3d.Origin, Vector3d.XAxis, -Vector3d.YAxis)
230222

231223
/// Builds Plane at first point, X-axis to second point,
232-
/// Y-axis to third point or at lest in plane with third point.
233-
/// Fails if points are closer than 1e-5.
224+
/// Y-axis to third point or at least in plane with third point.
225+
/// Fails if points are closer than 1e-6.
234226
static member createThreePoints (origin:Point3d) (xPt:Point3d) (yPt:Point3d) =
235227
let x = xPt-origin
236228
let y = yPt-origin
@@ -243,7 +235,7 @@ module AutoOpenPlane=
243235
let xu = Vector3d(x.X*xf, x.Y*xf, x.Z*xf)
244236
let yu = Vector3d(y.X*yf, y.Y*yf, y.Z*yf)
245237
if xu.IsParallelTo(yu, Cosine.``1.0``) then
246-
RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:.Plane.createThreePoints failed. The points are colinear by less than 1.0 degree, origin %s and xPt %s and yPt %s" origin.AsString xPt.AsString yPt.AsString
238+
RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:.Plane.createThreePoints failed. The points are collinear by less than 1.0 degree, origin %s and xPt %s and yPt %s" origin.AsString xPt.AsString yPt.AsString
247239
let z = Vector3d.cross (xu, yu)
248240
let y' = Vector3d.cross (z, x)
249241
Plane(origin, xu, y'.Unitized)
@@ -300,7 +292,7 @@ module AutoOpenPlane=
300292
let xu = Vector3d(xAxis.X *xf, xAxis.Y*xf, xAxis.Z*xf)
301293
let nu = Vector3d(normal.X*nf, normal.Y*nf, normal.Z*nf)
302294
if nu.IsParallelTo(xu, Cosine.``1.0``) then
303-
RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:.Plane.createOriginNormalXaxis failed. The vectors are colinear by less than 1.0 degrees, origin %s and normal %s and normal %s" origin.AsString normal.AsString xAxis.AsString
295+
RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:.Plane.createOriginNormalXaxis failed. The vectors are collinear by less than 1.0 degrees, origin %s and normal %s and xAxis %s" origin.AsString normal.AsString xAxis.AsString
304296
let y = Vector3d.cross (nu, xu)
305297
let x = Vector3d.cross (y, nu)
306298
Plane(origin, x.Unitized, y.Unitized)
@@ -387,7 +379,7 @@ module AutoOpenPlane=
387379
// let z = Vector3d.transformRigid m pl.ZAxis
388380
// Plane (o, x, y, z)
389381

390-
/// Rotate Plane 180 Degrees around Z-axis if the Y-axis orientation does not match World Y (pl.Yax.Y < 0.0)
382+
/// Rotate Plane 180 Degrees around Z-axis if the Y-axis orientation does not match World Y (pl.YAxis.Y < 0.0).
391383
/// To ensure that Y is always positive. For example for showing Text.
392384
static member inline rotateZ180IfYNegative (pl:Plane) =
393385
if pl.YAxis.Y < 0.0 then Plane.rotateOnZ180 pl else pl
@@ -425,8 +417,8 @@ module AutoOpenPlane=
425417
Some <| ((pl.Origin - ln.From) * z) / nenner
426418

427419

428-
/// Returns the line parameter and the X and Y parameters on the Plane. as tuple (pLn, pPlX, pPlY).
429-
/// The parameters is the intersection point of the infinite Line with the Plane.
420+
/// Returns the line parameter and the X and Y parameters on the Plane as tuple (pLn, pPlX, pPlY).
421+
/// The parameter is the intersection point of the infinite Line with the Plane.
430422
/// Returns None if they are parallel or coincident.
431423
static member intersectLineParameters (ln:Line) (pl:Plane) : option<float*float*float> =
432424
let z = pl.ZAxis

Src/Point3d.fs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ open Rhino
66
open Rhino.Geometry
77
open Rhino.Scripting.RhinoScriptingUtils
88
open UtilRHinoScriptingFSharp
9-
open System
109

1110
#nowarn "44" // for internal inline constructors and hidden obsolete members for error cases
1211

@@ -30,27 +29,27 @@ module AutoOpenPnt =
3029
//-----------------------------------------------------------------------------------------------------
3130

3231

33-
/// Returns a boolean indicating wether X, Y and Z are exactly 0.0.
32+
/// Returns a boolean indicating whether X, Y and Z are exactly 0.0.
3433
member inline pt.IsOrigin =
3534
pt.X = 0.0 && pt.Y = 0.0 && pt.Z= 0.0
3635

3736
/// Returns a boolean indicating if any of X, Y and Z is not exactly 0.0.
3837
member inline p.IsNotOrigin =
3938
p.X <> 0.0 || p.Y <> 0.0 || p.Z <> 0.0
4039

41-
/// Returns a boolean indicating wether the absolute value of X, Y and Z is each less than the given tolerance.
40+
/// Returns a boolean indicating whether the absolute value of X, Y and Z is each less than the given tolerance.
4241
member inline pt.IsAlmostOrigin tol =
43-
abs pt.X < tol && abs pt.Y < tol
42+
abs pt.X < tol && abs pt.Y < tol && abs pt.Z < tol
4443

4544
/// Returns new 3D point with new X coordinate, Y and Z stay the same.
4645
member inline pt.WithX x =
4746
Point3d (x, pt.Y, pt.Z)
4847

49-
/// Returns a new 3D vector with new y coordinate, X and Z stay the same.
48+
/// Returns a new 3D point with new Y coordinate, X and Z stay the same.
5049
member inline pt.WithY y =
5150
Point3d (pt.X, y, pt.Z)
5251

53-
/// Returns a new 3D vector with new z coordinate, X and Y stay the same.
52+
/// Returns a new 3D point with new Z coordinate, X and Y stay the same.
5453
member inline pt.WithZ z =
5554
Point3d (pt.X, pt.Y, z)
5655

@@ -143,14 +142,14 @@ module AutoOpenPnt =
143142

144143
/// A separate function to compose the error message that does not get inlined.
145144
[<Obsolete("Not actually obsolete but just hidden. (Needs to be public for inlining of the functions using it.)")>]
146-
member p.FailedAngle360InXYTo(fromPt:Point3d, toPt:Point3d) = RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:Point3d.closestPointOnLine: Line is too short for fromPt %O to %O and %O" fromPt toPt p
145+
member p.FailedClosestPointOnLine(fromPt:Point3d, toPt:Point3d) = RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:Point3d.ClosestPointOnLine: Line is too short for fromPt %O to %O and testPt %O" fromPt toPt p
147146

148147
/// Get closest point on finite line to test point.
149148
member inline testPt.ClosestPointOnLine(fromPt:Point3d, toPt:Point3d) =
150149
let dir = testPt - fromPt
151150
let v = toPt - fromPt
152151
let lenSq = v.LengthSq
153-
if isTooTinySq(lenSq) then testPt.FailedAngle360InXYTo(fromPt, toPt)
152+
if isTooTinySq(lenSq) then testPt.FailedClosestPointOnLine(fromPt, toPt)
154153
let dot = Vector3d.dot (v, dir) / lenSq
155154
if dot <= 0.0 then fromPt
156155
elif dot >= 1.0 then toPt
@@ -166,7 +165,7 @@ module AutoOpenPnt =
166165
let v = toPt - fromPt
167166
let lenSq = v.LengthSq
168167
if isTooTinySq(lenSq) then testPt.FailedDistanceToLine(fromPt, toPt)
169-
let dot = Vector3d.dot (v, dir) / v.LengthSq
168+
let dot = Vector3d.dot (v, dir) / lenSq
170169
if dot <= 0.0 then testPt.DistanceTo fromPt
171170
elif dot >= 1.0 then testPt.DistanceTo toPt
172171
else testPt.DistanceTo (fromPt + v * dot)
@@ -302,7 +301,9 @@ module AutoOpenPnt =
302301
/// If the returned vector has length zero then the points are in one line.
303302
static member normalOf3Pts (a:Point3d, b:Point3d, c:Point3d) = Vector3d.cross (a-b, c-b)
304303

305-
static member failedDistPt (fromPt:Point3d, dirPt:Point3d, distance:float) = RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:Point3d.distPt: distance form %O to %O is too small to scale to distance: %g" fromPt dirPt distance
304+
/// A separate function to compose the error message that does not get inlined.
305+
[<Obsolete("Not actually obsolete but just hidden. (Needs to be public for inlining of the functions using it.)")>]
306+
static member failedDistPt (fromPt:Point3d, dirPt:Point3d, distance:float) = RhinoScriptingFSharpException.Raise "Rhino.Scripting.FSharp:Point3d.distPt: distance from %O to %O is too small to scale to distance: %g" fromPt dirPt distance
306307

307308
/// Returns a point that is at a given distance from a 3D point in the direction of another point.
308309
static member inline distPt (fromPt:Point3d, dirPt:Point3d, distance:float) : Point3d =
@@ -519,8 +520,14 @@ module AutoOpenPnt =
519520
orientation:Vector3d) : struct(Vector3d * Vector3d * Point3d * Vector3d) =
520521
let vp = prevPt - thisPt
521522
let vn = nextPt - thisPt
522-
// if RhVec.isAngleBelowQuaterDegree(vp, vn) then // TODO refine error criteria
523-
if Vector3d.angleHalfPi vp vn < float Cosine.``0.25`` then
523+
// Check if vectors are nearly parallel (angle less than 0.25 degrees)
524+
// Use cross product magnitude relative to input lengths as parallelism test
525+
let cross = Vector3d.CrossProduct(vp, vn)
526+
let crossLenSq = cross.LengthSq
527+
let vpLenSq = vp.LengthSq
528+
let vnLenSq = vn.LengthSq
529+
// sin(0.25°)² ≈ 1.9e-5, so cross²/(|vp|²|vn|²) < 1e-5 means angle < ~0.18°
530+
if isTooTinySq(vpLenSq) || isTooTinySq(vnLenSq) || crossLenSq < vpLenSq * vnLenSq * 1e-5 then
524531
struct(Vector3d.Zero, Vector3d.Zero, Point3d.Origin, Vector3d.Zero)
525532
else
526533
let n =

0 commit comments

Comments
 (0)