geometry-surface

How to plot a surface with a texture map

孤街醉人 提交于 2019-12-30 05:15:07
问题 I want to plot a surface with a texture map on it, but the conditions are not the "ideal" ones. first lets explain what I have. I have a set of points (~7000) that are image coordinates, in a grid. This points do NOT define perfect squares. IT IS NOT A MESHGRID . For the sake of the question, lets assume that we have 9 points. Lets ilustrate what we have with an image: X=[310,270,330,430,410,400,480,500,520] Y=[300,400,500,300,400,500,300,400,500] Lets say we can get the "structure" of the

3D surface plot from 2D matrix

感情迁移 提交于 2019-12-30 03:04:08
问题 Using a 2d matrix in R, how can I create a 3d surface plot, where columns=x, rows=y and the values are the heights in z? In the example below, x values would be 1:5, y value would be 1:5, and the numbers would represent heights/values in z. > m<-matrix(rnorm(25),nrow=5,ncol=5) > m [,1] [,2] [,3] [,4] [,5] [1,] -1.495513045 0.8000040 -1.1499261 1.65661138 0.8140510 [2,] -1.150018195 -0.7582933 0.8306922 0.16026908 0.3913198 [3,] -0.852609406 0.5525621 0.3585986 -0.45054768 -1.2259927 [4,] -0

Doing readback from Direct3D textures and surfaces

六眼飞鱼酱① 提交于 2019-12-28 12:08:28
问题 I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to system memory? In short I'm looking for concise descriptions of how to copy the following to system memory : a texture a subset of a texture a surface a subset of a surface a D3DUSAGE_RENDERTARGET texture a subset of a D3DUSAGE

ILNumerics Drawing a surface having (x,y,z) coordinates

有些话、适合烂在心里 提交于 2019-12-24 06:58:08
问题 I am really new in programming with C#. I have an Array of points in the following form //An Array containing point coordinates: double[,] graphData=new double[100,3]; //Each element of graph data contain coordinate of a point: graphData[1;:]=(x1,y1,z1); I wanna draw a surface using ILNumerics. I couldn't find any example for this case. Would you please help me? 回答1: The link posted in the accepted answer points to an outdated part of the ILNumerics documentation which is obsolete now. Up

Vertex position relative to normal

心已入冬 提交于 2019-12-23 13:35:14
问题 In a surface shader , given the world's up axis (and the others too), a world space position and a normal in world space, how can we rotate the worldspace position into the space of the normal? That is, given a up vector and a non-orthogonal target-up vector, how can we transform the position by rotating its up vector? I need this so I can get the vertex position only affected by the object's rotation matrix, which I don't have access to. Here's a graphical visualization of what I want to do:

Calculate the horizon of a curved face?

烂漫一生 提交于 2019-12-22 11:01:04
问题 I need to find the 2 points of the visual horizon , of a curved face. I have: XYZ of the 4 corner points XYZ of the 2 curved edge bezier points And I need to calculate either: XY of the horizon points XYZ of the horizon points 回答1: First off you have to convert your 3D beziers to 2D. If I remember right it's sufficient to project the curves just like you project 3D points for rendering. Afterwards you have to find the extrema of the curves. A small HowTo: Convert your bezier-curve from bezier

Is there any way to “clear” a surface?

自古美人都是妖i 提交于 2019-12-22 05:35:15
问题 Is there any way to clear a surface from anything that has been blitted to it? 回答1: When I dont care about performance, I use: mysurface.fill((0,0,0)) Which will draw the specified color (black in this case) across the entire surface. Is that what you meant by "clear"? Oh, and you need, of course, to "flip" the surface after doing this for it to be visible on the screen. 回答2: I don't know what API you're using, so here's a vague answer: In virtually all cases "clearing" a surface simply blits

Calculate the eccentricity of ellipses

不想你离开。 提交于 2019-12-22 01:43:39
问题 I've like to calculate the eccentricity of ellipses x, in my example: #Artificial ellipse a <- 1 # semi-major axis e <- x# eccentricity b <- a * sqrt(1 - e^2) # semi-minor axis c <- 1.3 # ellipse area But I need to make this using the ellipse area (c) in the calculation. This is poisible? 回答1: b = c/(pi*a); x = (sqrt(a^2 - b^2))/a; is the formula you need. Or put togther: x = (sqrt(a^2 - (c/(pi*a))^2))/a; 来源: https://stackoverflow.com/questions/55676436/calculate-the-eccentricity-of-ellipses

Create PDF with (resized) PNG images using Pycairo - rescaling Surface issue

折月煮酒 提交于 2019-12-21 20:59:57
问题 I have som PNG image links that I want to download, "convert to thumbnails" and save to PDF using Python and Cairo. Now, I have a working code, but I don't know how to control image size on paper. Is there a way to resize a PyCairo Surface to the dimensions I want (which happens to be smaller than the original)? I want the original pixels to be "shrinked" to a higher resolution (on paper). Also, I tried Image.rescale() function from PIL, but it gives me back a 20x20 pixel output (out of a

Combining scatter plot with surface plot

家住魔仙堡 提交于 2019-12-20 12:16:10
问题 How can I combine a 3D scatter plot with a 3D surface plot while keeping the surface plot transparent so that I can still see all the points? 回答1: To combine various types of plots in the same graph you should use the function plt.hold(True). The following code plots a 3D scatter plot with a 3D surface plot: from mpl_toolkits.mplot3d import * import matplotlib.pyplot as plt import numpy as np from random import random, seed from matplotlib import cm fig = plt.figure() ax = fig.gca(projection=