[Bf-extensions-cvs] [1a4e2421] master: add_advanced_objects_panels: unsupported: removed from repo T63750
meta-androcto
noreply at git.blender.org
Wed Jun 12 04:00:21 CEST 2019
Commit: 1a4e242128048620791b81f14cbb407c046f9929
Author: meta-androcto
Date: Wed Jun 12 11:59:59 2019 +1000
Branches: master
https://developer.blender.org/rBAC1a4e242128048620791b81f14cbb407c046f9929
add_advanced_objects_panels: unsupported: removed from repo T63750
===================================================================
D add_advanced_objects_panels/DelaunayVoronoi.py
D add_advanced_objects_panels/__init__.py
D add_advanced_objects_panels/delaunay_voronoi.py
D add_advanced_objects_panels/drop_to_ground.py
D add_advanced_objects_panels/object_laplace_lightning.py
D add_advanced_objects_panels/object_mangle_tools.py
D add_advanced_objects_panels/oscurart_constellation.py
D add_advanced_objects_panels/unfold_transition.py
===================================================================
diff --git a/add_advanced_objects_panels/DelaunayVoronoi.py b/add_advanced_objects_panels/DelaunayVoronoi.py
deleted file mode 100644
index d291d700..00000000
--- a/add_advanced_objects_panels/DelaunayVoronoi.py
+++ /dev/null
@@ -1,998 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Voronoi diagram calculator/ Delaunay triangulator
-#
-# - Voronoi Diagram Sweepline algorithm and C code by Steven Fortune,
-# 1987, http://ect.bell-labs.com/who/sjf/
-# - Python translation to file voronoi.py by Bill Simons, 2005, http://www.oxfish.com/
-# - Additional changes for QGIS by Carson Farmer added November 2010
-# - 2012 Ported to Python 3 and additional clip functions by domlysz at gmail.com
-#
-# Calculate Delaunay triangulation or the Voronoi polygons for a set of
-# 2D input points.
-#
-# Derived from code bearing the following notice:
-#
-# The author of this software is Steven Fortune. Copyright (c) 1994 by AT&T
-# Bell Laboratories.
-# Permission to use, copy, modify, and distribute this software for any
-# purpose without fee is hereby granted, provided that this entire notice
-# is included in all copies of any software which is or includes a copy
-# or modification of this software and in all copies of the supporting
-# documentation for such software.
-# THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
-# REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
-# OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
-#
-# Comments were incorporated from Shane O'Sullivan's translation of the
-# original code into C++ (http://mapviewer.skynet.ie/voronoi.html)
-#
-# Steve Fortune's homepage: http://netlib.bell-labs.com/cm/cs/who/sjf/index.html
-#
-# For programmatic use, two functions are available:
-#
-# computeVoronoiDiagram(points, xBuff, yBuff, polygonsOutput=False, formatOutput=False):
-# Takes :
-# - a list of point objects (which must have x and y fields).
-# - x and y buffer values which are the expansion percentages of the
-# bounding box rectangle including all input points.
-# Returns :
-# - With default options :
-# A list of 2-tuples, representing the two points of each Voronoi diagram edge.
-# Each point contains 2-tuples which are the x,y coordinates of point.
-# if formatOutput is True, returns :
-# - a list of 2-tuples, which are the x,y coordinates of the Voronoi diagram vertices.
-# - and a list of 2-tuples (v1, v2) representing edges of the Voronoi diagram.
-# v1 and v2 are the indices of the vertices at the end of the edge.
-# - If polygonsOutput option is True, returns :
-# A dictionary of polygons, keys are the indices of the input points,
-# values contains n-tuples representing the n points of each Voronoi diagram polygon.
-# Each point contains 2-tuples which are the x,y coordinates of point.
-# if formatOutput is True, returns :
-# - A list of 2-tuples, which are the x,y coordinates of the Voronoi diagram vertices.
-# - and a dictionary of input points indices. Values contains n-tuples representing
-# the n points of each Voronoi diagram polygon.
-# Each tuple contains the vertex indices of the polygon vertices.
-#
-# computeDelaunayTriangulation(points):
-# Takes a list of point objects (which must have x and y fields).
-# Returns a list of 3-tuples: the indices of the points that form a Delaunay triangle.
-
-import bpy
-import math
-
-# Globals
-TOLERANCE = 1e-9
-BIG_FLOAT = 1e38
-
-
-class Context(object):
-
- def __init__(self):
- self.doPrint = 0
- self.debug = 0
-
- # tuple (xmin, xmax, ymin, ymax)
- self.extent = ()
- self.triangulate = False
- # list of vertex 2-tuples: (x,y)
- self.vertices = []
- # equation of line 3-tuple (a b c), for the equation of the line a*x+b*y = c
- self.lines = []
-
- # edge 3-tuple: (line index, vertex 1 index, vertex 2 index)
- # if either vertex index is -1, the edge extends to infinity
- self.edges = []
- # 3-tuple of vertex indices
- self.triangles = []
- # a dict of site:[edges] pairs
- self.polygons = {}
-
-
-# Clip functions #
- def getClipEdges(self):
- xmin, xmax, ymin, ymax = self.extent
- clipEdges = []
- for edge in self.edges:
- equation = self.lines[edge[0]] # line equation
- if edge[1] != -1 and edge[2] != -1: # finite line
- x1, y1 = self.vertices[edge[1]][0], self.vertices[edge[1]][1]
- x2, y2 = self.vertices[edge[2]][0], self.vertices[edge[2]][1]
- pt1, pt2 = (x1, y1), (x2, y2)
- inExtentP1, inExtentP2 = self.inExtent(x1, y1), self.inExtent(x2, y2)
- if inExtentP1 and inExtentP2:
- clipEdges.append((pt1, pt2))
- elif inExtentP1 and not inExtentP2:
- pt2 = self.clipLine(x1, y1, equation, leftDir=False)
- clipEdges.append((pt1, pt2))
- elif not inExtentP1 and inExtentP2:
- pt1 = self.clipLine(x2, y2, equation, leftDir=True)
- clipEdges.append((pt1, pt2))
- else: # infinite line
- if edge[1] != -1:
- x1, y1 = self.vertices[edge[1]][0], self.vertices[edge[1]][1]
- leftDir = False
- else:
- x1, y1 = self.vertices[edge[2]][0], self.vertices[edge[2]][1]
- leftDir = True
- if self.inExtent(x1, y1):
- pt1 = (x1, y1)
- pt2 = self.clipLine(x1, y1, equation, leftDir)
- clipEdges.append((pt1, pt2))
- return clipEdges
-
- def getClipPolygons(self, closePoly):
- xmin, xmax, ymin, ymax = self.extent
- poly = {}
- for inPtsIdx, edges in self.polygons.items():
- clipEdges = []
- for edge in edges:
- equation = self.lines[edge[0]] # line equation
- if edge[1] != -1 and edge[2] != -1: # finite line
- x1, y1 = self.vertices[edge[1]][0], self.vertices[edge[1]][1]
- x2, y2 = self.vertices[edge[2]][0], self.vertices[edge[2]][1]
- pt1, pt2 = (x1, y1), (x2, y2)
- inExtentP1, inExtentP2 = self.inExtent(x1, y1), self.inExtent(x2, y2)
- if inExtentP1 and inExtentP2:
- clipEdges.append((pt1, pt2))
- elif inExtentP1 and not inExtentP2:
- pt2 = self.clipLine(x1, y1, equation, leftDir=False)
- clipEdges.append((pt1, pt2))
- elif not inExtentP1 and inExtentP2:
- pt1 = self.clipLine(x2, y2, equation, leftDir=True)
- clipEdges.append((pt1, pt2))
- else: # infinite line
- if edge[1] != -1:
- x1, y1 = self.vertices[edge[1]][0], self.vertices[edge[1]][1]
- leftDir = False
- else:
- x1, y1 = self.vertices[edge[2]][0], self.vertices[edge[2]][1]
- leftDir = True
- if self.inExtent(x1, y1):
- pt1 = (x1, y1)
- pt2 = self.clipLine(x1, y1, equation, leftDir)
- clipEdges.append((pt1, pt2))
- # create polygon definition from edges and check if polygon is completely closed
- polyPts, complete = self.orderPts(clipEdges)
- if not complete:
- startPt = polyPts[0]
- endPt = polyPts[-1]
- # if start & end points are collinear then they are along an extent border
- if startPt[0] == endPt[0] or startPt[1] == endPt[1]:
- polyPts.append(polyPts[0]) # simple close
- else: # close at extent corner
- # upper left
- if (startPt[0] == xmin and endPt[1] == ymax) or (endPt[0] == xmin and startPt[1] == ymax):
- polyPts.append((xmin, ymax)) # corner point
- polyPts.append(polyPts[0]) # close polygon
- # upper right
- if (startPt[0] == xmax and endPt[1] == ymax) or (endPt[0] == xmax and startPt[1] == ymax):
- polyPts.append((xmax, ymax))
- polyPts.append(polyPts[0])
- # bottom right
- if (startPt[0] == xmax and endPt[1] == ymin) or (endPt[0] == xmax and startPt[1] == ymin):
- polyPts.append((xmax, ymin))
- polyPts.append(polyPts[0])
- # bottom left
- if (startPt[0] == xmin and endPt[1] == ymin) or (endPt[0] == xmin and startPt[1] == ymin):
- polyPts.append((xmin, ymin))
- polyPts.append(polyPts[0])
- if not closePoly: # unclose polygon
- polyPts = polyPts[:-1]
- poly[inPtsIdx] = polyPts
- return poly
-
- def clipLine(self, x1, y1, equation, leftDir):
- xmin, xmax, ymin, ymax = self.extent
- a, b, c = equation
- if b == 0: # vertical line
- if leftDir: # left is bottom of vertical line
- return (x1, ymax)
- else:
- return (x1, ymin)
- elif a == 0: # horizontal line
- if leftDir:
- return (xmin, y1)
- else:
- return (xmax, y1)
- else:
- y2_at_xmin = (c - a * xmin) / b
- y2_at_xmax = (c - a * xmax) / b
- x2_at_ymin = (c - b * ymin) / a
- x2_at_ymax = (c - b * ymax) / a
- intersectPts = []
- if ymin <= y2_at_xmin <= ymax: # valid intersect point
- intersectPts.append((xm
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list