Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
acb8ec9
Attempted to add the selection of a circle and to change the color of…
browermb Mar 10, 2018
8723538
Added code to calculate the intersection of a circle and attempt to c…
browermb Mar 13, 2018
52ff096
Fixed the color of the selection of nodes, color of selection of disk…
browermb Mar 13, 2018
2bbf84b
Skeleton of selection tool added
browermb Mar 19, 2018
69ad606
Implemented selection tool for DiskS2 and PointS2
browermb Mar 19, 2018
54932d4
Implemented selection tool for DiskS2 and PointS2
browermb Mar 20, 2018
54c67eb
Made changes to the mouse tool in order to account for a java bug on …
browermb Mar 22, 2018
32cd203
Added code for a construction of an intersection point given two disks
browermb Mar 22, 2018
6bc42da
Merge branch 'maddy-branch' of https://github.com/johncbowers/KoebeLi…
browermb Mar 22, 2018
7cea07a
Added code for a construction of an intersection point given two disks
browermb Mar 22, 2018
4ce656c
merge lib+builder gradle builds to single build
mastqe Jun 26, 2018
6e2bf70
convert to standard gradle source set layout
mastqe Jun 26, 2018
5f93e6b
restructure so antlr source files are generated with gradle during build
mastqe Jun 26, 2018
3f260f3
move gradle wrapper to default location
mastqe Jun 30, 2018
aa40c3d
update build to generate run configs
mastqe Jul 1, 2018
63ef751
set explicit version for Kotlin stdlib to match gradle plugin
mastqe Jul 1, 2018
b3fe594
Update README for new, stand-alone Gradle build system.
mastqe Jul 1, 2018
b7ac824
Added intersection tool.
browermb Jul 26, 2018
eb50aac
Bad commit. Adding new tool from MaddieBranch to MaddieBranch2
browermb Jul 26, 2018
143316c
Merge branch 'master' into gradle-only-build
mastqe Aug 2, 2018
fd6c347
rearrange upstream to fit new src structure
mastqe Aug 2, 2018
ed0d7bf
new run config
mastqe Aug 2, 2018
f4c8cfa
Fixed bugs in the Coaxial point tool now working correctly.
browermb Aug 13, 2018
1acdf8b
merge upstream
mastqe Aug 17, 2018
38f4d0f
Update library versions
mastqe Feb 6, 2019
8051c0e
added code for 3 disks to c-plane
Feb 8, 2019
7da0801
merge maddy-branch-2
mastqe Feb 9, 2019
0807e60
upgrade gradle wrapper version
mastqe Feb 23, 2019
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
155 changes: 78 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Koebe-Lib Development Environment

The purpose of this library is to support the creation of geometric constructions in the inversive
geometry of circles on the 2-sphere. The design of the code base was heavily influenced by Sherif Ghali's [Introduction to Geometric Computing](http://www.springer.com/us/book/9781848001145). This is an excellent reference for anyone interesting in coding a geometric library and gives a good overview of the various design decisions involved. Ghali also gives plenty of companion C++ code, which we referred to for coding several of the operations on various geometric objects and the structure of the `geometry.primitives` package is in line with Ghali's suggestion for how to structure such libraries.
The purpose of this library is to support the creation of geometric constructions in the inversive geometry of circles on the 2-sphere.
The design of the code base was heavily influenced by Sherif Ghali's [Introduction to Geometric Computing](http://www.springer.com/us/book/9781848001145).
This is an excellent reference for anyone interesting in coding a geometric library and gives a good overview of the various design decisions involved.
Ghali also gives plenty of companion C++ code, which we referred to for coding several of the operations on various geometric objects and the structure of the `geometry.primitives` package is in line with Ghali's suggestion for how to structure such libraries.

# App
# App

The code base also has one application (well, there are a few dummy ones that I need to remove/clean up) that is a first version of what I hope will eventually become a [GeoGebra](http://geogebra.org)-like application for inversive geometric constructions. That is the `SphericalSketch` found in the `sketches` package. This application loads a little bare-bones Python IDE and 3D view that allows a user to create and visualize geometric constructions on the fly. Eventually we will post some sample scripts somewhere in this repository.
The code base also has one application (well, there are a few dummy ones that I need to remove/clean up) that is a first version of what I hope will eventually become a [GeoGebra](http://geogebra.org)-like application for inversive geometric constructions.
That is the `SphericalSketch` found in the `sketches` package.
This application loads a little bare-bones Python IDE and 3D view that allows a user to create and visualize geometric constructions on the fly.
Eventually we will post some sample scripts somewhere in this repository.

# Codebase
# Codebase

This is a _very_ alpha-level release. I'm just getting started with this code base, and have some ideas for applications to build on top of it, but I decided to go ahead and release it, because some others are starting to use the code base and thus there needs to be a public repository.
This is a _very_ alpha-level release.
I'm just getting started with this code base, and have some ideas for applications to build on top of it, but I decided to go ahead and release it, because some others are starting to use the code base and thus there needs to be a public repository.

The codebase is written in Kotlin and is developed in JetBrain’s IDEA IntelliJ.

Here is a set-up guide for getting a development environment up and running.

The codebase has some weird dependencies.
They are all managed with Gradle and do not need to be retreived manually.
The codebase is written in Kotlin and is developed in JetBrain’s IntelliJ IDEA.
There are some weird dependencies, but they are all managed with Gradle and do not need to be retreived manually.

- cpcore.jar 2.8 - Extracted from CirclePack [link](http://www.math.utk.edu/%7Ekens/CirclePack/downloads/)
- jython-standalone 2.7.0 - [link](http://www.jython.org/downloads.html)
Expand All @@ -26,70 +28,69 @@ They are all managed with Gradle and do not need to be retreived manually.
- processing-core 3.3.6 - [link](https://processing.org/download/)
- antlr4 4.7.1 - [link](https://www.antlr.org/download.html)

I have also included an ArcBall class that was converted to Kotlin and lightly modified. The
original can be found [here](https://github.com/RandomEtc/processing-arcball/).

# Setting up the dev-environment.

Dependency gathering and building is done with Gradle.
A local installation can be used, or a Gradle wrapper is available in the bin directory.
To use the wrapper substitute `../bin/gradlew` for `gradle` in the steps below.

## Method 1: IntelliJ Project

The goal of this method is to easily retrieve all dependency JARs and register them as dependencies in the IntelliJ project.
Building and Running is all done through IntelliJ's systems.

### Step 1: Download dependencies
1. Clone the repo
2. In the `lib` directory run `gradle all`
3. This will download all dependencies to `<project-path>/lib/jar`

### Step 2: Create a new IntelliJ Project
1. Create a new project
2. Select 'Kotlin' in the left pane and 'Kotlin (JVM)' and click 'Next'
3. Name the project whatever you want, like 'Koebe-Lib'
4. Change the project location to the cloned repo and click 'Finish'

### Step 3: Add dependencies to project
1. Open Project Structure dialog (Command+; or Ctrl+Shift+Alt+S)
2. Click 'Modules' and open the Dependencies tab
3. Click '+' and select 'JARs or directories...'
4. Select the `<project-path>/lib/jar` folder
5. Click the 'Export' checkbox and click 'Apply' and 'OK'

### Step 4: Create a runtime configuration.
1. Right click on the the `src/sketches/SphericalSketch.kt` file
2. Select the Run option

## Method 2: Standalone Gradle build

The goal of this method is to allow for building and running without using IntelliJ.

### Configuration
All standalone building is done in the builder directory.
Configuration options are available in `settings.gradle`

### Option 1: Build a JAR
1. From the `builder` directory run `gradle jar`
2. A standalone executable JAR will be built in `build/lib/koebelib.jar`
3. This can be run with `java -jar build/lib/koebelib.jar`

### Option 2: Package a Distribution
1. From the `builder` directory run `gradle build`
2. A tarball and a zip file distribution will be built in `build/distibutions/koebelib.tar|zip`

### Option 3: Install a Distribution
1. From the `builder` directory run `gradle install`
2. A distribution will be installed in `build/install/koebelib`
3. This can be run with the start script at `build/install/koebelib/bin/koebelib`

### Option 4: Just compile (cannot be run)
1. From the `builder` directory run `gradle compileKotlin`

#### Notes:
Because of how Gradle handles dependencies we cannot run the program from a gradle build
that has not been bundled in some form (ie options 1-3 above).
Attempting to use `gradle run` or other methods may result in missing native libraries.
I have also included an ArcBall class that was converted to Kotlin and lightly modified. The
original can be found [here](https://github.com/RandomEtc/processing-arcball/).

# The dev-environment.

Building and run configuration is all done through Gradle.
For use with IntelliJ IDEA the project should be imported as a Gradle project and built/run using the Gradle tasks.
Debugging through IntelliJ IDEA works as normal for Gradle tasks.
Tasks can be run with a local installation of Gradle, or using the included Gradle wrapper.
To use the wrapper substitute `./gradlew` for `gradle` in the examples below.

### Configuration of run tasks
Configuration options are available in `settings.gradle`
Run configurations for new main classes can be created there.

## Gradle tasks
Clone the repo. All Gradle tasks are run from the root of the repository.
View available tasks with the `gradle tasks` command.
The main tasks to use are described below.

### Compile Kotlin
Run `gradle compileKotlin`
This compiles the source code with no additional actions taken.
This can be useful when just checking for compiler errors, but is generally not needed.

### Generate ANTLR Grammar Sources
Run `gradle generateGrammarSource`
This will run ANTLR to generate source files for grammars in the `src/main/antlr/main` directory.
The files will be placed in `build/generated-src/antlr/main` if needed for reference.
This task is automatically run when compiling to make the ANTLR source available to the build.

### Run the application
There are several run configurations available of the form `gradle run<class>`
Each builds the application and runs their respective main class.

### Build a JAR for distribution
Run `gradle jar`
A standalone executable 'fat' jar will be built in `build/lib/koebelib.jar`
This jar should be suitable for distribution as it includes all dependencies.
It can be run with `java -jar build/lib/koebelib.jar`
The main class is specified in `settings.gradle` or with the `-Pmain=<class>` argument.

### Cleanup the build directory
Run `gradle clean`
The build directory will be deleted.

## Using IntelliJ IDEA

1. Clone the repo.
2. Select import project in IntelliJ.
3. Select the `build.gradle` file from the cloned repo.
4. Configure import options.
- Check 'Use auto-import'.
- Uncheck 'Create separate module per source set'
- Select 'Use default gradle wrapper' or 'Use local gradle distribution'
5. Open the Gradle tool window.
- View > Tool Windows > Gradle
6. Select a run configuration
- Tasks > koebelib > run\<class\>

**_Disclaimer_**
Building the application and creating run configurations with IntelliJ's native tools may work.
It is, however, not supported and is not guaranteed to work in all cases.

#koebe-lib

Binary file removed bin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
95 changes: 95 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
plugins {
id 'com.google.osdetector' version '1.4.0'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'antlr'
}

// Set the main class for application and jar building
// - set in settings.gradle or
// defined with -Pmain=<class> in build command
ext.mainClassName = project.findProperty('main') ?: gradle.ext.defaultClassName

// Use maven central repository for dependencies
repositories {
mavenCentral()
}

dependencies {
// Kotlin standard library
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.3.21'

// KoebeLib dependencies
compile files('lib/jar/cpcore.jar')
compile 'org.python:jython-standalone:2.7.0'
compile 'com.fifesoft:rsyntaxtextarea:2.6.1'
compile 'org.jogamp.jogl:jogl-all-main:2.3.2'
compile 'org.jogamp.gluegen:gluegen-rt-main:2.3.2'
compile ('org.processing:core:3.3.6') {
transitive = false
}

// Antlr dependency
antlr 'org.antlr:antlr4:4.7.2'
}

// Ensures that the lib/jar folder exists for downloading cpcore.jar
task chkLib {
doLast {
def f = new File('lib/jar/')
if (!f.exists()) { f.mkdirs() }
}
}

// Downloads cpcore.jar on Linux systems
task get_nix(type:Exec, dependsOn:chkLib) {
workingDir 'lib/jar/'
commandLine '../getCirclePack.sh'
}

// Downloads cpcore.jar on Windows systems
task get_win(type:Exec, dependsOn:chkLib) {
workingDir 'lib/jar/'
commandLine 'powershell', '-ExecutionPolicy', 'RemoteSigned', '-c', '../getCirclePack.ps1'
}

// Detects operating system and downloads cpcore.jar
task get {
if (osdetector.os == 'windows') {
dependsOn get_win
}
else {
dependsOn get_nix
}
}

// Only retrieve CirclePack cpcore.jar if not already done
def cpcore = new File('lib/jar/cpcore.jar')
get_nix.onlyIf { !cpcore.exists() }
get_win.onlyIf { !cpcore.exists() }

// Can't compile without cpcore.jar
compileKotlin.dependsOn(get)
// Can't compile without Antlr grammar generated files
compileKotlin.dependsOn(generateGrammarSource)

// Build a fat jar with main class defined earlier
jar {
manifest {
attributes 'Main-Class' : project.mainClassName
}

from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}

// Dynamically build run configurations for configured classes
gradle.ext.drivers.each { name, className ->
tasks.register("run$name")
task "run$name" (type: JavaExec, dependsOn: jar, overwrite: true) {
description "Runs the ${name}.kt main class"
group "KoebeLib"

main "$className"
classpath fileTree("$jar.destinationDir")
}
}

55 changes: 0 additions & 55 deletions builder/build.gradle

This file was deleted.

4 changes: 0 additions & 4 deletions builder/settings.gradle

This file was deleted.

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
2 changes: 1 addition & 1 deletion bin/gradlew → gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/gradlew.bat → gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading