Giter VIP home page Giter VIP logo

Comments (5)

FlorianRhiem avatar FlorianRhiem commented on September 15, 2024

Do you have an image of what you are trying to achieve? gr3.createsurfacemesh would used be for creating a surface plot. A "rectangular grid of lines" sounds more like something built from cylinders (and possibly spheres for the corners) like this:

import gr3
import numpy as np

n_per_axis = 11
n = 2*n_per_axis
positions = np.zeros((n, 3))
positions[:n_per_axis, 0] = np.linspace(-2, 2, n_per_axis)
positions[:n_per_axis, 1] = -2
positions[n_per_axis:, 0] = -2
positions[n_per_axis:, 1] = np.linspace(-2, 2, n_per_axis)
directions = np.zeros((22, 3))
directions[:n_per_axis, 1] = 1
directions[n_per_axis:, 0] = 1
colors = np.ones((22, 3))
radii = 0.01 * np.ones(22)
lengths = 4 * np.ones(22)

gr3.drawcylindermesh(n, positions, directions, colors, radii, lengths)
gr3.export("grid.png", 1000, 1000)

grid

As an aside: 0 * gr3.GR3_SurfaceOption.GR3_SURFACE_FLAT is equal to 0 and therefore gr3.GR3_SurfaceOption.GR3_SURFACE_DEFAULT.

from gr.

nilsbecker avatar nilsbecker commented on September 15, 2024

thanks! this looks like what i would like to achieve. i did not think of the cylinder option - i was considering that there must be some sort of 'line' primitive also in 3D with a constant width. the surface plot functions must also use something like that to draw the mesh, no? would a surface plot of a constant-zero function not also work?

the 0 * .. bit was a quick test that i mistakenly copied-and-pasted.

from gr.

FlorianRhiem avatar FlorianRhiem commented on September 15, 2024

GR3 does not support 2D primitives like points and lines, so cylinders or cuboids would be the way to go for a grid. The gr3_createsurfacemesh function creates a 3D mesh based on the x, y and z arrays.

from gr.

nilsbecker avatar nilsbecker commented on September 15, 2024

i think i misunderstood what gr3_createsurfacemesh does. i thought it generates a wireframe-like surface representation. but instead it generates a surface mesh which is rendered as a solid surface -- correct?

from gr.

FlorianRhiem avatar FlorianRhiem commented on September 15, 2024

Correct. Together with functions like gr3.surface and gr3.drawsurface it serves as somewhat of an equivalent to gr.surface.

from gr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.