fogleman / choppy Goto Github PK
View Code? Open in Web Editor NEWChop 3D models in half with a user-defined slice plane.
Chop 3D models in half with a user-defined slice plane.
# github.com/fogleman/triangle
/tmp/go-build161286829/b064/_x003.o: In function `parsecommandline':
../../../../pkg/mod/github.com/fogleman/[email protected]/triangle.c:3327: undefined reference to `cos'
../../../../pkg/mod/github.com/fogleman/[email protected]/triangle.c:3528: undefined reference to `sqrt'
etc ...
Line 42 in a669283
Michael, thank you for your open-source contributing! It helps.
Question - Could clipTriangle be something like next ?
Plane intersects triangle always by line, right?
if len(inFront) == 3 {
triangles = append(triangles, t)
} else if len(inFront) == 2 {
line := plane.IntersectTriangle(&t)
triangles = append(triangles, NewTriangle(inFront[0], line.P1, line.P2))
triangles = append(triangles, NewTriangle(inFront[0], line.P2, inFront[1]))
} else if len(inFront) == 1 {
line := plane.IntersectTriangle(&t)
triangles = append(triangles, NewTriangle(inFront[0], line.P1, line.P2))
}
As i understand you use just more common way with sutherlandHodgman, Barycentric, etc, right?
Where plane.IntersectTriangle(&t) can be like this:
func (p Plane) IntersectTriangle(t *Triangle) *Line {
v1 := p.IntersectSegment(t.P1, t.P2)
v2 := p.IntersectSegment(t.P2, t.P3)
v3 := p.IntersectSegment(t.P3, t.P1)
var p1, p2 Point
...........
n := p1.VectorTo(p2).Cross(p.N)
..........
return &Line{p2, p1}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.