1. Products
  2.   3D
  3.   GO
  4.   Pinhole
 
  

Free Go Library for 3D Wireframe Drawing

Open Source Go 3D Library for 3D Wireframe Drawing. It allows Software Developers to Render 3D Files with a very simple API for Visualizing Data Structures.

The world of programming constantly evolves, offering us new tools and libraries that redefine our capabilities. Enter "Pinhole" – a remarkable 3D Wireframe Drawing library for the Go programming language. With Pinhole, software developers can embark on a journey to create stunning 3D wireframe visualizations with ease. Pinhole is an open-source Go library that empowers software developers to craft intricate 3D wireframe drawings without the need for complex graphics algorithms. It provides a user-friendly interface, allowing software developers to focus on the creative aspect of generating captivating visual scenes. With Pinhole, the world of 3D graphics becomes accessible to both beginners and experienced developers, making it an exciting addition to the Go ecosystem.

One of Pinhole's standout features is its intuitive and easy-to-use API. Creating 3D objects, defining viewpoints, and rendering scenes becomes a breeze, enabling developers to translate their ideas into visuals without a steep learning curve. The library opens a gateway to the mesmerizing world of 3D wireframe drawing for Go developers. By abstracting away the complexities of 3D graphics algorithms, Pinhole empowers developers to focus on the creative aspect of crafting captivating visual scenes. Whether you're an educator, a designer, an artist, or simply a curious developer, the library invites you to explore the possibilities of 3D wireframe visualization. So why not dive in, experiment, and see where your imagination takes you with the power of "Pinhole"?

Previous Next

Getting Started with Pinhole

The recommend way to install Pinhole is using GitHub. Please use the following command for a smooth installation.

Install Pinhole API via Get command

$ go get -u github.com/tidwall/pinhole 

You can download the compiled shared library from Github repository.

Create and Manage 3D Scene via Go API

The open source Pinhole library allows software developers to create and manage 3D scene inside their own Go applications. The library has included support for several important features, such as creating a basic 3D scene, adding objects, configuring the camera, rendering the scene and many more. The library has provides a variety of primitive 3D shapes that you can use in your scene. It is also possible to create custom objects by defining vertices, edges, or faces and add them to your scene. The following example shows how software developers can create a 3D scene using Go commands.

How to Create a Basic 3D Scene via Go Library?

import "github.com/tidwall/pinhole"

// Initialize the Scene
scene := pinhole.NewScene()

// Create 3D Objects:
cube := pinhole.NewCube()

//create custom objects and added to the scene
triangle := pinhole.NewObject()
triangle.Vertices = []pinhole.Vertex{
    {X: 0, Y: 0, Z: 0},
    {X: 1, Y: 0, Z: 0},
    {X: 0, Y: 1, Z: 0},
}
triangle.Edges = []pinhole.Edge{
    {0, 1},
    {1, 2},
    {2, 0},
}

scene.AddObject(cube)
scene.AddObject(triangle)

// Configure the Camera

camera := pinhole.NewCamera()
camera.Position = pinhole.Vector{X: 0, Y: 0, Z: 5} // Adjust the camera position
camera.Target = pinhole.Vector{X: 0, Y: 0, Z: 0}   // Set the camera's target (where it's looking)
scene.SetCamera(camera)

// Render the Scene and display out

renderer := pinhole.NewRenderer(scene)
renderer.Render()

Rendering Customization & Camera Control

Software Developers can customize the rendering style of wireframe scenes with options for line colors, thickness, and background settings. This flexibility empowers software developers to achieve their desired visual aesthetics. Moreover, the library provides powerful camera controls, enabling software developers to adjust camera position, orientation, and projection settings. This feature allows for dynamic exploration of 3D scenes and enhances user interactivity.

Versatile Object Creation via Go API

The Pinhole library has included a wide range of primitive shapes such as cubes, spheres, and cones, making it easy to create common 3D objects. Additionally, developers can define custom objects by specifying vertices, edges, and faces, allowing for the creation of complex and unique wireframe scenes. Engineers and designers can use the library to quickly prototype and visualize 3D models, aiding in the evaluation of designs and identification of potential issues before committing to full-scale development.

How to Add, rotate, and transform a circle via Go API?

p := pinhole.New()
p.DrawCube(-0.3, -0.3, -0.3, 0.3, 0.3, 0.3)
p.Rotate(math.Pi/3, math.Pi/6, 0)

p.Begin()
p.DrawCircle(0, 0, 0, 0.2)
p.Rotate(0, math.Pi/2, 0)
p.Translate(-0.6, -0.4, 0)
p.Colorize(color.RGBA{255, 0, 0, 255})
p.End()

p.SavePNG("cube.png", 500, 500, nil)