GithubHelp home page GithubHelp logo

mathesis-software / knots Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 0.0 53.23 MB

A tool for drawing 2d diagrams, 3d knots, Seifert surfaces. Computes some knot properties and invariants.

License: Apache License 2.0

C++ 99.27% QMake 0.73%
knot-theory topology mathematics math knots knot knot-diagram

knots's Introduction

KnotEditor

Description

Originally written in 199x. One of @geometer's first programming projects.

Refurbished in July-September 2021. Special thanks to @temper8 for OpenGL smoothing solution.

Written in C++/Qt6, tested on Linux (Ubuntu 20.04) + Qt 6.1.3, and MacOSX (Monterey 12.0 beta, Intel) + Qt 6.1.3.

An app for

  • drawing knot diagrams
  • converting them to 3d knots
  • smoothing the knots
  • computing and showing Seifert surfaces
  • computing some knot invariants
  • etc.

For possible improvements list please refer the TODO. Please, note: this is not a roadmap. Just a collection of thoughts. Maybe I implement something from the list in the future, maybe not.

Build & installation instructions

Linux

Build dependencies

C++ compiler (the code uses some C++17 features), Qt6, OpenGL, rapidjson.

To install build dependencies on Ubuntu 20.04:

sudo apt install g++ make ccache libgl-dev rapidjson-dev

Qt6 is available from the Qt site. KnotEditor is truly open-source, so feel free to use the open-source Qt edition for this app.

To build

cd KnotEditor
/<your-path-to-qt6>/<version>/gcc_64/bin/qmake

(e.g., ~/Qt6/6.1.3/gcc_64/bin/qmake)

make

To install

By default, the app is installed to /usr/local/bin/KnotEditor. Single binary, no additional files. Alternatively, you can change the INSTALL_PREFIX var in src/qmake.pri.

sudo make install

To run

KnotEditor

MacOS X

You can build it from the sources, as described below. Alternatively, you can

Download disk image with precompiled app

DMG Image: KnotEditor for MacOS Monterey (Intel)

Build dependencies

Clang C++ compiler, ccache, Qt6, rapidjson.

To install rapidjson use:

brew install rapidjson

Qt6 is available from the Qt site. KnotEditor is truly open-source, so feel free to use the open-source Qt edition for this app.

To build

cd KnotEditor
/<your-path-to-qt6>/<version>/macos/bin/qmake

(e.g., ~/Qt6/6.1.3/macos/bin/qmake)

make

To install

After a successful build, the app is in src/qt folder. Open the folder in Finder and drag-n-drop the app to the Applications folder. Please note that Qt frameworks are not included in the app. If you plan to delete Qt installation from your Mac, run

/<your-path-to-qt6>/<version>/macos/bin/macdeployqt src/qt/KnotEditor.app

before installation.

Screenshots

Torus 5x2 knot, from a diagram to a smooth image Knot library

knots's People

Contributors

geometer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

knots's Issues

Make mouse wheel zoom more consistent with other actions and less confusing

  1. For more consistency, save the zoom factor in the knot file between runs. I suggest dropping the separate "scaleFactor" field and use the existing transformation matrix instead.
  2. Again, for consistency, the app should suggest saving of the scene if the user has scaled it. As far as I remember, changing of the matrix is enough to get this feature for free.
  3. I suggest adding "zoom factor" field to the visual options dialogue.
  4. As for "confusion", if I rotate wheel too fast, the scene becomes invisible, and I cannot even know if the knot is too small or too large. A possible solution is to set hard limits for the scale factor. Another idea is slow down zooming where the factor is close to the limits.

PS Probably, it makes sense to split this ticket.

Shorten src/other/CMakeLists.txt

Currently, it consists of five blocks (one per command-line tool), and each block mentions the corresponding tool name four times. Is it possible to replace the scheme with a loop?

Migrate from OpenGL to Vulkan

It seems like OpenGL does not allow to do some modern things on MacOS, e.g. styling. And moreover, I expect there is no OpenGL on Mac M1.

Maybe, migration to Metal for Apple platform is even better solution (at least it is native). However, in this case we need to have different code for different platforms.

Add version in knot and diagram serialization formats

Serialization formats are tend to change. To have the chance to software to understand if it is compatible with provided chunk of data it make sense to have version number in serialized data.

There is no intention to support backward compatibility yet.

Do not pass version number in -DVERSION=<version> command line argument

The suggestion is to create a file using a template during compilation. A sample template (for a header) is attached.

#ifndef __KE_VERSION_H__
#define __KE_VERSION_H__

#include <string>

namespace KE::Version {

const std::string version = "2.0β1";
const std::string hash = "<hash from git>";
const std::string date = "<current date>";

inline std::string build() {
  return hash.substr(0, 14) + " (" + date + ")";
}

}

#endif /* __KE_VERSION_H__ */```

Do not download rapidjson if it is available locally

If the system provides rapidjson headers, it is not necessary to download them during building. I suggest implementing a scheme that

  1. checks if rapidjson is presented on the system, and uses it if found;
  2. if 1) fails, runs as now.

Probably, it makes sense to consider other solutions as well.

Create normalization method for rotation matrix

Rotation matrix in KnotWrapper due to accumulated error may cease to be orthogonal. It's necessary to develop normalization method for matrix orthogonalization and use it after each matrix change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.