473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Lots of Actors

Dear all,

I want to use line segments to display a 3D vector field.
However, my progrm becomes very slow when displaying this vector field if
the number of lin segments is very huge. Is there any better method to do
it ?
Thanks in advance !!!

Below is my code :
line = []
line_mapper = []
self.line_actor = []
for i in range(0, vf_points.num):
line.append(vtkLineSource())
line[i].SetPoint1(vf_points.x[i],vf_points.y[i],vf_points.z[i])
line[i].SetPoint2(vf_points.x[i] + vf.vx[i],vf_points.y[i] +
vf.vy[i],vf_points.z[i] + vf.vz[i])
line_mapper.append(vtkPolyDataMapper())
line_mapper[i].SetInput(line[i].GetOutput())
self.line_actor.append(vtkActor())
self.line_actor[i].SetMapper(line_mapper[i])
self.line_actor[i].GetProperty().SetLineWidth(1)
self.line_actor[i].GetProperty().SetColor(0,1,1)
self.line_actor[i].PickableOff()
self.tar_renderer.AddActor(self.line_actor[i])

__________________________________________________ _______________
¥[¤J MSN ªÀ¸s¡G¾Ö©ê¸s²³¡B¤À¨É¸gÅç¡Bµo²{¥Í¬¡ªº¼Ö½ì
http://groups.msn.com?pgmarket=zh-tw
Jul 18 '05 #1
1 1241
Yi-Yu Chou wrote:

I want to use line segments to display a 3D vector field.
However, my progrm becomes very slow when displaying this vector field if
the number of lin segments is very huge. Is there any better method to do
it ?
Thanks in advance !!!

Below is my code :
line = []
line_mapper = []
self.line_actor = []
for i in range(0, vf_points.num):
line.append(vtkLineSource())
line[i].SetPoint1(vf_points.x[i],vf_points.y[i],vf_points.z[i])
line[i].SetPoint2(vf_points.x[i] + vf.vx[i],vf_points.y[i] +
vf.vy[i],vf_points.z[i] + vf.vz[i])
line_mapper.append(vtkPolyDataMapper())
line_mapper[i].SetInput(line[i].GetOutput())
self.line_actor.append(vtkActor())
self.line_actor[i].SetMapper(line_mapper[i])
self.line_actor[i].GetProperty().SetLineWidth(1)
self.line_actor[i].GetProperty().SetColor(0,1,1)
self.line_actor[i].PickableOff()
self.tar_renderer.AddActor(self.line_actor[i])


What makes you think the above code, specifically, is the cause of the
slowness? It doesn't look to me as though the above code is actually
doing the rendering, but merely setting things up to be rendered. On
the other hand, without any idea what a tar_renderer is, or anything
else about the code, it's hard to tell.

If the above is really the part that needs to be optimized, and only
profiling or something like that will tell you, you could save at least
a tiny bit of time by binding a local variable to self.line_actor[i] and
using that in subsequent lines in place of the longer form, which
involves a dictionary lookup (on self) and an index operation repeatedly.

I'd look for more points of concern, but it doesn't seem productive
unless you have evidence that this is really the bottleneck in your
code.

-Peter
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shenron | last post by:
Hello, I'm trying to translate my website in some languages, therefore I include a file which contains all words. This is something like that: $hello_english="Hello"; in lang_en.php...
12
by: Paul Moore | last post by:
One of the things I really dislike about Unittest (compared, say, to a number of adhoc testing tricks I've used in the past, and to Perl's "standard" testing framework) is that the...
0
by: Mickel Grönroos | last post by:
Hi everybody, This is a question about Tkinter.Canvases and performance: I am writing a Tkinter application that among other things contains a number of Tkinter.Canvases that in turn hold...
4
by: Thomas Rast | last post by:
Hello everyone My scenario is somewhat involved, so if you're in a hurry, here's an abstract: I have a daemon that needs about 80MB of RAM to build its internal data structures, but can pack...
10
by: AlexS | last post by:
Hi, I wonder if anybody can comment if what I see is normal in FW 1.1 and how to avoid this. I have .Net assembly, which creates literally thousands of temporary strings and other objects...
2
by: Darryl Kerkeslager | last post by:
As the subject above hopefully makes clear, I want to do several reports, "with lots of fields not otherwise in database". These reports also have variable-length text. I have defined the...
1
by: | last post by:
Im working in some hydraulics calcs.(using lots of loops) that produces lots of data, where can I send this data to be easy readable. I tried with rictextboxes but it only accepts one line. I was...
17
by: Neil Cerutti | last post by:
The Glk API (which I'm implementing in native Python code) defines 120 or so constants that users must use. The constants already have fairly long names, e.g., gestalt_Version, evtype_Timer,...
6
by: Dave Stallard | last post by:
So, I'm looking at some code that does 770K malloc calls in a row, of varying size, paired with corresponding freads from a binary file to initialize. In total, about 58 MB of data is allocated...
1
by: hockeymtl | last post by:
Hy all, ( sql server 2000 ) I have trouble with my indexes in my database after I inserted lots of data in some user tables ( 10000 + insert ). I need to pinpoint where to look to solve my problem....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.