All Projects → LoicGoulefert → occult

LoicGoulefert / occult

Licence: MIT License
vpype plug-in to remove occulted lines in SVG files

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to occult

vec
Vector graphics software to generate HPGL output to drive a plotter
Stars: ✭ 19 (-40.62%)
Mutual labels:  plotter, vector-graphics
animatePaper.js
An animation library for paper.js.
Stars: ✭ 33 (+3.13%)
Mutual labels:  vector-graphics
vectorshapes-unity
Library for drawing vector shapes in Unity.
Stars: ✭ 44 (+37.5%)
Mutual labels:  vector-graphics
vad-plotter
Plotter for NEXRAD VWP retrievals.
Stars: ✭ 18 (-43.75%)
Mutual labels:  plotter
ludigraphix.github.io
Documentation for Ludigraphix
Stars: ✭ 21 (-34.37%)
Mutual labels:  vector-graphics
chiagen
standalone chia generator
Stars: ✭ 13 (-59.37%)
Mutual labels:  plotter
elementary-plotlib
C/C++ Plotting Library
Stars: ✭ 19 (-40.62%)
Mutual labels:  vector-graphics
ommpfritt
semantic, procedural, non-destructive vector modelling
Stars: ✭ 37 (+15.63%)
Mutual labels:  vector-graphics
pixi-omber-gltf2-vector
Pixi.js library for using vector art created in Omber that's saved in glTF 2.0 format
Stars: ✭ 13 (-59.37%)
Mutual labels:  vector-graphics
rouziclib
This is my personal library of code that is common to my different projects (Photosounder, SplineEQ, Spiral and others)
Stars: ✭ 38 (+18.75%)
Mutual labels:  vector-graphics
Cairo
Swift library for Cairo
Stars: ✭ 33 (+3.13%)
Mutual labels:  vector-graphics
lovector
A pure-lua vector graphics processing and rendering library for LÖVE 2D
Stars: ✭ 29 (-9.37%)
Mutual labels:  vector-graphics
vpype-pixelart
Pixel art plotting in vpype
Stars: ✭ 40 (+25%)
Mutual labels:  vector-graphics
neon
Generative art piece made using 2d vector field
Stars: ✭ 26 (-18.75%)
Mutual labels:  vector-graphics
antenna analyzer
Arduino Uno based graphical SWR HF/VHF 160-1.25m bands antenna analyzer, plotter based on Si5351 module
Stars: ✭ 18 (-43.75%)
Mutual labels:  plotter
grbl-mega-wall-plotter
(WIP) A variant of Grbl (v1.1g) for Arduino Mega with support for hanging wall plotters
Stars: ✭ 15 (-53.12%)
Mutual labels:  plotter
AnimatedVectorDrawableCompat-play-to-reset-button
An Android app using the AnimatedVectorDrawable support library
Stars: ✭ 56 (+75%)
Mutual labels:  vector-graphics
qt5-vector-graphic-shaders
A Qt5 application to experiment vector graphic shaders
Stars: ✭ 37 (+15.63%)
Mutual labels:  vector-graphics
Clarity
Customizable Monoshape Vector Icon Theme for GTK+
Stars: ✭ 37 (+15.63%)
Mutual labels:  vector-graphics
cloud gen
Procedural Generation of Clouds with Vector Graphics
Stars: ✭ 46 (+43.75%)
Mutual labels:  vector-graphics

occult

vpype plug-in to remove lines occulted by polygons from SVG files.

Examples

Basic usage

Draw a line, then a square:

vpype line 0 0 5cm 5cm rect 2cm 2cm 1cm 1cm show

Same drawing, after applying occult:

vpype line 0 0 5cm 5cm rect 2cm 2cm 1cm 1cm occult show

Order of path is important: occult will consider the last geometry in a SVG file to be "on top" of all other geometries, the last but one is above every other geometries except the last one. For instance, using vpype rect 2cm 2cm 1cm 1cm occult show will not modify geometries.

Working with multiple layers

By default, occult performs occlusion layer by layer. For instance, applying occlusion on the image below will not change anything:

occult -i ignores layers, so that occlusion is performed on all objects, regardless of their layer. Geometries in layers with a larger ID number are considered to be "on top" of geometries in layers with a smaller ID number.

  • Without -i flag

  • With -i flag

Save occulted lines

occult -k keeps occulted lines in a separate layers.

  • Without -k flag

  • With -k flag

Using vpype's viewer (show command), you can visualize occulted lines and remaining lines separately.

Using occult with Vsketch

occult can be invoked from a Vksetch sketch, using vsk.vpype("occult"). When using the GUI, calling occult within the sketch draw() method will display occulted geometries at each code save / seed change. For sketches with lots of geometries, occlusion can take a significant amount of time. Invoke occult within the finalize() method of a sketch to perform occlusion only when saving a specific output.

import vsketch

class Sketch(vsketch.SketchClass):
    def draw(self, vsk: vsketch.Vsketch):
        vsk.size('10x10cm')
        vsk.scale('mm')
        
        vsk.line(-5, -5, 5, 5)
        vsk.circle(0, 0, 3)

        # Uncomment to perform occlusion at every GUI reload
        # vsk.vpype("occult")
  
    def finalize(self, vsk: vsketch.Vsketch) -> None:
        # Occlusion (and other vpype commands) invoked only when saving
        vsk.vpype("linesimplify occult linemerge linesort")


if __name__ == "__main__":
    Sketch.display()

Installation

See the installation instructions for information on how to install vpype.

Existing vpype installation

Use this method if you have an existing vpype installation (typically in an existing virtual environment) and you want to make this plug-in available. You must activate your virtual environment beforehand.

$ pip install git+https://github.com/LoicGoulefert/occult.git#egg=occult

Check that your install is successful:

$ vpype --help
Usage: vpype [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Options:
  -v, --verbose
  -I, --include PATH  Load commands from a command file.
  --help              Show this message and exit.

Commands:
[...]
  Plugins:
    occult
[...]

Stand-alone installation

Use this method if you need to edit this project. First, clone the project:

$ git clone https://github.com/LoicGoulefert/occult.git
$ cd occult

Create a virtual environment:

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip

Install occult and its dependencies (including vpype):

$ pip install -e .

Check that your install is successful:

$ vpype --help
Usage: vpype [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Options:
  -v, --verbose
  -I, --include PATH  Load commands from a command file.
  --help              Show this message and exit.

Commands:
[...]
  Plugins:
    occult
[...]

Documentation

The complete plug-in documentation is available directly in the CLI help:

$ vpype occult --help

License

See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].