Skip to content

Commit

Permalink
Improve polygon.center docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Sep 26, 2023
1 parent 0983f51 commit 2bf913b
Show file tree
Hide file tree
Showing 17 changed files with 20,479 additions and 20,240 deletions.
1 change: 1 addition & 0 deletions Sources/Polygon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public extension Polygon {
}

/// The position of the center of the polygon.
/// This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon's ``bounds``.
var center: Vector {
vertices.reduce(.zero) { $0 + $1.position } / Double(vertices.count)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/documentation/euclid/bounds/init(_:)-27jri.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
{
"kind" : "text",
"text" : " = []) "
"text" : ") "
},
{
"kind" : "keyword",
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/area.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/bounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
34 changes: 34 additions & 0 deletions docs/data/documentation/euclid/polygon/center.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"hierarchy" : {
Expand Down Expand Up @@ -370,6 +387,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/hastexcoords.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/hasvertexcolors.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/isconvex.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/orderededges.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/plane.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/undirectededges.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
17 changes: 17 additions & 0 deletions docs/data/documentation/euclid/polygon/vertices.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,23 @@
{
"text" : "The position of the center of the polygon.",
"type" : "text"
},
{
"text" : " ",
"type" : "text"
},
{
"text" : "This is calculated as the average of the vertex positions, and may not be equal to the center of the polygon’s ",
"type" : "text"
},
{
"identifier" : "doc:\/\/com.charcoaldesign.Euclid\/documentation\/Euclid\/Polygon\/bounds",
"isActive" : true,
"type" : "reference"
},
{
"text" : ".",
"type" : "text"
}
],
"fragments" : [
Expand Down
Loading

0 comments on commit 2bf913b

Please sign in to comment.