graphics

I have an OpenGL Tessellated Sphere and I want to cut a cylindrical hole in it

霸气de小男生 提交于 2019-12-28 01:38:11
问题 I am working on a piece of software which generated a polygon mesh to represent a sphere, and I want to cut a hole through the sphere. This polygon mesh is only an overlay across the surface of the sphere. I have a good idea of how to determine which polygons will intersect my hole, and I can remove them from my collection, but after that point I am getting a little confused. I was wondering if anyone could help me with the high-level concepts? Basically, I envision three situations: 1.) The

贪吃蛇系列之三——在窗口上绘制出简单的方形

断了今生、忘了曾经 提交于 2019-12-27 19:54:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 有了游戏的窗口了,接下来我们就开始在游戏的窗口中绘制出一些图形,由于我们做的是贪吃蛇嘛,就画一个方形吧,下面还是直接看代码: /** * 绘制界面的方法 */ @Override public void paint(Graphics g) { //设置画笔的颜色 g.setColor(Color.BLUE); //绘制出一个蓝色的正方形 g.fill3DRect(50, 50, 30, 30, true); } 我们得到的效果如下图: 我们既然要画图,就需要重写一个叫做paint(Graphics g)的方法,我们的java虚拟机将调用这个方法对窗口进行绘制,我们要实现的绘图逻辑呢就是在这里面来实现。这里要特别注意,是paint方法,不是print方法,很多同学不留心就会出错,到后面检查代码怎么都找不到错误的原因。 关于Graphics参数的理解。你可以理解为我们作画的画笔或者画布,这都是可以的。 关于g.fill3DRect(50, 50, 30, 30, true); 这句话的理解。这个方法就是我们让jvm帮我们绘制一个方形在窗口上,这个方法呢有5个参数,前两个参数是方块的起始横坐标。这里呢有一个常识就是,在我们的计算机绘图中,都是以窗口的左上角为坐标原点的,横坐标向右为正方向,纵坐标向下为正方向

NullPointerException at Graphics.drawOval [duplicate]

限于喜欢 提交于 2019-12-25 20:01:35
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 3 years ago . The question is simple. I have created a class named "handler" and within its constructor it contains a parameter for "c", a JComponent. When this constructor is called on a certain JComponent, preferably a JPanel, an oval is drawn at the mouse's current coordinates. This is the source code: import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent;

Adding Legends to a radarchart [closed]

纵然是瞬间 提交于 2019-12-25 18:49:11
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . By following this thread I have created a radar chart. Can anyone suggest me how to add a legend to this graph? 回答1: Here's a generic legend to get you started. You can alter it to suit your particular needs:

What is the name of this font? [closed]

寵の児 提交于 2019-12-25 18:32:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . What is the name of this font? : 回答1: Here you are. EDIT: Following Mark Ransom's suggestion I'm adding the link to the site where the results were obtained. To find a font as close to the original as possible, kindly upload an image that contains as many characters as possible. The results obtained may not be

Cutting part of an image out and keeping the original image

感情迁移 提交于 2019-12-25 18:32:24
问题 So I have a black image that acts as darkness (In my game). I want to show a small portion around the character only. Like so The red square is the player. The green bit is the ground in the game (grass). The black is the shadow/darkness. What I want to do is cut a Ellipse/hole out of the blank, black image. I want this Ellipse to be centered around the players (The red square) x and y position. Currently I am using this to get the effect: for(int x = 0; x < width; x++) { for(int y = 0; y <

Computer Graphics implementing Viewing Pipeline

落花浮王杯 提交于 2019-12-25 18:29:30
问题 This is a continuation to this question. In a nutshell I'm implementing viewing pipeline using Java AWT, imitating the behaviour of OpenGL (without using it of course). Changes from the older question I've changed projection to Orthographic instead of Perspective (so the transformation is just removing the z-index now, keeping x,y the same). Changes to input files: Cube file (notice it contains 6 faces of the cube now instead 12 polylines like before, but it doesn't actually change anything)

Use UI array in a function Qt C++

天涯浪子 提交于 2019-12-25 18:14:42
问题 In my Windows forms code, ui is used to define graphical element by default. But I want to modify them in a function, like this: The problems is that the debug tool tells me that ui is not declared in this scope. #include <QMessageBox> #include <QFile> #include <QTextStream> #include "mainwindow.h" #include "ui_mainwindow.h" #include "datawindow.h" void getData(ui){ QFile inputFile("C:\\pepoles.txt"); if (inputFile.open(QIODevice::ReadOnly)){ QTextStream in(&inputFile); while ( !in.atEnd() ){

Java - Drawing a dynamic shape outline

↘锁芯ラ 提交于 2019-12-25 12:43:16
问题 I wish to create a dynamic outline to a Shape (AWT) by adding objects (with draw functions) to appropriate positions on screen along the shape's perimeter. I want a roughly even distance between each object. (An alternative approach to the same affect will be fine.) How might I acquire the locations for these objects? I know shapes have a path iterator, but I have no idea how to use it. 回答1: You might look at a library such as the one described in A Shape Diagram Editor. If you want to

Java JFrame draw

两盒软妹~` 提交于 2019-12-25 12:09:14
问题 I'm currently working with JFrame and I'm trying to draw a rectangle but I don't know how to execute the code paint(Graphics g) , how do I get the Graphics object? package com.raggaer.frame; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; public class Frame { private JFrame frame; public Frame() { this.frame = new JFrame("Java Snake"); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.frame.setSize(new Dimension(500, 500)); // DRAW?? this.frame