Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release via GitHub Tag (with dev versions)

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install tools
run: |
cargo install cargo-set-version

- name: Extract version from tag
id: version
run: |
TAG=${GITHUB_REF_NAME}
VERSION=${TAG#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"

- name: Set release version
run: |
VERSION=${{ steps.version.outputs.version }}
echo "Setting release version $VERSION"
cargo set-version $VERSION

- name: Commit release version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="${{ github.event.release.target_commitish }}"
git add Cargo.toml
git commit -m "chore: set release version v${{ steps.version.outputs.version }}"
git push origin HEAD:$BRANCH

- name: Move release tag to new commit
run: |
TAG=${{ github.event.release.tag_name }}
git tag -fa "$TAG" -m "Release $TAG (after version bump)"
git push origin "$TAG" --force
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polyshell"
version = "0.1.0"
version = "0.0.2-test"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
15 changes: 7 additions & 8 deletions src/algorithms/simplify_charshape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,27 @@ fn characteristic_shape<T>(orig: &Polygon<T>, eps: T, max_len: usize) -> Polygon
where
T: GeoFloat + SpadeNum,
{
let orig_len = orig.exterior().0.len();

if orig_len < 3 {
if orig.exterior().0.len() < 3 {
return orig.clone();
}

let eps_2 = eps * eps;

// Construct Delaunay triangulation
let num_vertices = orig.exterior().0.len() - 1;

let vertices = orig
.exterior_coords_iter()
.take(orig_len - 1) // duplicate points are removed
.take(num_vertices) // duplicate points are removed
.map(|c| Point2::new(c.x, c.y))
.collect::<Vec<_>>();

let edges = (0..orig_len - 2)
let edges = (0..num_vertices)
.map(|i| {
if i == 0 {
[vertices.len() - 1, i]
} else {
[i, i + 1]
[i - 1, i]
}
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -143,8 +143,7 @@ where
continue;
}

let [from, to] = largest.edge.vertices().map(|v| v.index());
if (to == from + 1) || (from == to + 1) || (to + from + 2 == orig_len) {
if largest.edge.is_constraint_edge() {
continue;
}

Expand Down