Search Results

Search found 8384 results on 336 pages for 'lines'.

Page 2/336 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Drawing lines in 3D space

    - by DeadMG
    When attempting to draw a line in 3D space with D3DPT_LINELIST, then Direct3D gives me an error about an invalid vertex declaration, saying that it cannot be converted to an FVF. I am using the same vertex declaration and shader/stream setup as for my D3DPT_TRIANGLELIST rendering which works absolutely correctly. How can I use D3DPT_LINELIST to render some lines in 3D space? Edit: Oopsie, forgot my codeses. Here's my raw Draw call. D3DCALL(device->SetStreamSource(1, PerBoneBuffer.get(), 0, sizeof(PerInstanceData))); D3DCALL(device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA | 1)); D3DCALL(device->SetStreamSource(0, LineVerts, 0, sizeof(D3DXVECTOR3))); D3DCALL(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA | lines.size())); D3DCALL(device->SetIndices(LineIndices)); PerInstanceData* data; std::vector<Wide::Render::Line*> lines_vec(lines.begin(), lines.end()); D3DCALL(PerBoneBuffer->Lock(0, lines.size() * sizeof(PerInstanceData), reinterpret_cast<void**>(&data), D3DLOCK_DISCARD)); std::for_each(lines.begin(), lines.end(), [&](Wide::Render::Line* ptr) { data->Color = D3DXColor(ptr->Colour); D3DXMATRIXA16 Translate, Scale, Rotate; D3DXMatrixTranslation(&Translate, ptr->Start.x, ptr->Start.y, ptr->Start.z); D3DXMatrixScaling(&Scale, ptr->Scale, 1, 1); D3DXMatrixRotationQuaternion(&Rotate, &D3DQuaternion(ptr->Rotation)); data->World = Scale * Rotate * Translate; }); D3DCALL(PerBoneBuffer->Unlock()); D3DCALL(device->DrawIndexedPrimitive(D3DPRIMITIVETYPE::D3DPT_LINELIST, 0, 0, 2, 0, 1)); Here's my vertex declaration: D3DVERTEXELEMENT9 BasicMeshVertices[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, {1, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, {1, 32, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2}, {1, 48, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3}, {1, 64, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; The LineIndices are just 0, 1 and the LineVerts are just {0,0,0} and {1,0,0}, to represent a unit 3D line along the X axis.

    Read the article

  • Is there any algorithm for finding LINES by PIXEL COLORS on picture?

    - by Ole Jak
    So I have Image like this I want to get something like this (I hevent drawn all lines I want but I hope you can get my idea) I need algorithm for finding all straight lines on it by just reading colors of pixels. No hard math, no Haar, no Hough. Some algorithm which would be based on points colors. I want to give to algorithm parameters like min line length and max line distortion. I want to get relative to picture pixel coords start and end points of lines. So I need algorithm for finding straight lines of different colors on picture. Algorithm which would be based on idea of image of different colors and Lines of static colors. Yes - such algorithm will not work for images with lots of shadows and lights. But It willl probably be fast (I hope so). Is there any such algorithm?

    Read the article

  • Is there any super fast algorithm for finding LINES on picture?

    - by Ole Jak
    So I have Image like this I need some super fast algorithm for finding all straight lines on it. I want to give to algorithm parameters like min length and max line distortion. I want to get relative to picture pixel coords start and end points of lines. So on this picture to find all lines between dalles and thouse 2 black lines on top. So I need algorithm for super fast finding straight lines of different colors on picture. Is there any such algorithm? (super duper fast=)

    Read the article

  • Quickly compute added and removed lines

    - by Philippe Marschall
    I'm trying to compare two text files. I want to compute how many lines were added and removed. Basically what git diff --stat is doing. Bonus points for not having to store the entire file contents in memory. The approach I'm currently having in mind is: read each line of the old file compute a hash (probably MD5 or SHA-1) for each line store the hashes in a set do the same for each line in the new file every hash from the old file set that's missing in the new file set was removed every hash from the new file set that's missing in the old file set was added I'll probably want to exclude empty and all white space lines. There is a small issue with duplicated lines. This can either be solved by additionally storing how often a hash appears or comparing the number of lines in the old and new file and adjust either the added or removed lines so that the numbers add up. Do you see room for improvements or a better approach?

    Read the article

  • Add text to the beginning of every other line in notepad+-+

    - by Paul M
    Please advise how to add text to the beginning of every other line in notepad+-+ Actually, what I want to do is... Add (title) to the beginning of lines 1, 3, 5, etc...(hundreds of lines in a notepad++ file) Add (/title) to the end of lines 1, 3, 5, etc... Then... Add (link) to the beginning of even number lines (e.g. lines 2, 4, 6, 8, etc...) Add (/link) to the end of even number lines (e.g. lines 2, 4, 6, 8, etc...) Thanks

    Read the article

  • Visual Studio 2010 tip: Cut empty lines

    - by koevoeter
    How many times you wanted to move 2 lines by cut and pasting them, but the line you cut last is actually a blank line and your actual code is removed from the clipboard? Visual Studio 2010 has an option that keeps cutting blank lines from overwriting the clipboard. Go and uncheck this one: Tools » Options » Text Editor » All Languages » General » Apply Cut or Copy commands to blank lines when there is no selection Extra (related) tip The (free) Visual Studio 2010 extension Visual Studio 2010 Pro Power Tools contains (apart from a bunch of other handy features) the commands Edit.MoveLineUp and Edit.MoveLineDown to do whatever they say they do and maps them automatically to keyboard shortcuts Alt+Up & Alt+Down. Resharper (not-free) has similar commands for moving lines, by default mapped to Ctrl+Alt+Shift+Up/Down.

    Read the article

  • Identifying connected lines drawn free-hand by a user

    - by rawrgoesthelion
    I have a series of 'images' described by a mixture of connected lines and curves. Users will draw on the screen, free hand, and my goal is to break their drawing down into a series of lines and curves that can be matched with the 'images' in my set. For the sake of simplicity, let's assume this is occurring on a touch screen. These lines will be connected. Each time the user's finger moves, the dx and dy is recorded. The drawing is considered complete and analyzed when the user's finger leaves the screen. I'm having trouble figuring out a good way to break the user's drawing down into lines. Is there any well known approach to this problem, a C++ library that solves it, or any good articles/technical papers on how to achieve this?

    Read the article

  • 10 lines of code per day is the global average!? -- true?

    - by Earlz
    Ok so last year I participated in a high school curriculum contest thing at a college(I currently attend this college). I actually got 1st in it but was still a bit angry I didn't get every single one right. The most baffling of questions on there was How many lines of code does the average programmer write per day? A. 5 B. 10 C. 25 D. 30 Aside from being a subjective question which depended on language and everything else I was more baffled at what they had as the correct answer. 10. Even on my bad days at my job I touch more than 10 lines of code(either adding, modifying, or deleting) per day. And when I took this test I had only programmed as a hobby where it was common for me to write a few hundred lines for one of my new projects per day. Where are they getting this random number of ten!? Is this published somewhere? A quick googling found me nothing.

    Read the article

  • Using awk to split text file every 10,000 lines

    - by Sneaky Wombat
    I have a large gzip'd text file. I'd like to something like: zcat BIGFILE.GZ | awk (snag 10,000 lines and redirect to...)|gzip -9 smallerPartFile.gz the awk part up there, I basically want it to take 10,000 lines and send it to gzip and then repeat until all lines in the original input file are consumed. I found a script that claims to do this, but when I run it on my files and then diff the original to the ones that were split and then merged, lines are missing. So, something is wrong with the awk part and I'm not sure what part is broken. Here's the code. Can someone tell me why this doesn't yield a file that can be split and merged and then diff'd to the original successfully? # Generate files part0.dat.gz, part1.dat.gz, etc. # restore with: zcat foo* | gzip -9 > restoredFoo.sql.gz (or something like that) prefix="foo" count=0 suffix=".sql" lines=10000 # Split every 10000 line. zcat /home/foo/foo.sql.gz | while true; do partname=${prefix}${count}${suffix} # Use awk to read the required number of lines from the input stream. awk -v lines=${lines} 'NR <= lines {print} NR == lines {exit}' >${partname} if [[ -s ${partname} ]]; then # Compress this part file. gzip -9 ${partname} (( ++count )) else # Last file generated is empty, delete it. rm -f ${partname} break fi done

    Read the article

  • Certain grid lines not rendering as expected

    - by row1
    I am drawing a simple quad (a triangle strip with 4 vertices) as the floor and then drawing an 8x8 grid over top (a collection of vertex pairs for a line list). The vertical grid lines work fine (apart from being very aliased), but some of the horizontal lines do not get rendered. The grid renders fine if I do not draw the quad. foreach (EffectPass pass in _Effect.CurrentTechnique.Passes) { pass.Apply(); CurrentGraphicsDevice.SetVertexBuffer(_VertexFloorBuffer); _Engine.CurrentGraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); //Some of the horizontal lines seems to disappear if we draw the above quad. CurrentGraphicsDevice.SetVertexBuffer(_VertexGridBuffer); CurrentGraphicsDevice.DrawPrimitives(PrimitiveType.LineList, 0, _VertexGridBuffer.VertexCount / 2); } What could be causing these lines to not be rendered? Update: I added the below code after I draw my quad and grid and it started working. But I am not sure why that works as I thought this code was to draw the WPF controls elementRenderer.Render(); spriteBatch.Begin(); spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White); spriteBatch.End();

    Read the article

  • Long lines of text in source code [closed]

    - by ale
    Possible Duplicate: Is the 80 character limit still relevant in times of widescreen monitors? I used to set a vertical line set at 80 characters in my text editor and then I added carriage returns if the lines got too long. I later increased the value to 135 characters. I started using word wrap and not giving myself a limit but tried to keep lines short if I could because it took a lot of time shortening my lines. People at work use word wrap and don't give themselves a limit.. is this the correct way? What are you meant to do ? Many thanks.

    Read the article

  • Connect divs with (non-straight) lines [migrated]

    - by Snailer
    I'd like to develop my site with a layout that looks somewhat like houses with connected plumbing, or multiple computers connected to a network. Basically, the will be boxes floating in space, with lines connecting some of the boxes. I'd like these lines to have some turns in them as well (just simple 90 degree corners) rather than just a straight line. My question is what is the best way to achieve this, and perhaps a small example. My thoughts were to use: PHP and CSS: I could create a background grid and then, with some complicated algorithms, draw paths using the grid's borders. This would be more dynamic, but I'm not sure I can plot the math all by myself. just CSS: Perhaps this is as simple as making some pre-drawn lines like L-shapes and T-junctions, then just placing and scaling them. But I don't believe there's a way to scale an image by slicing it.. so the line width would be scaled and thus each image would look different. Any thoughts?

    Read the article

  • AutoKey inserts blank lines

    - by Mike Pretzlaw
    Situation GNOME Shell AutoKey / autokey-gtk it has a predefined shortcut "adr" which should write an address after hitting space and a shortcut "date" which should write the current date (after hitting tab) Problem no matter what I define, "adr" or "date" it always inserts as much blank lines as the template uses Example: "date" should autocomplete after pressing space to "13/08/01" but it inserts one empty line "adr" should do my full address but it inserts 4 empty lines Question What could be wrong with my AutoKey? Do you need additional information?

    Read the article

  • Purple/Pink lines on screen after login on Ubuntu Desktop 13.04

    - by Thomas May
    I downloaded Ubuntu 13.04 and I loaded up the live system. It loaded up fine but when I clicked on the Ubuntu logo purple and pink lines appeared on screen and they didn't go away so I thought that if I installed the OS it would be fine so I installed the OS, logged in and lo and behold the purple and pink lines where back. My video card is nVidia N force (I think) Anyone having the same problem???

    Read the article

  • Combine CSS lines into one [migrated]

    - by ZEDA-NL
    I want to define some basic styles that I can combine. Let's say I have a stylesheet that contains the following lines: .whitebackground {background-color: #ffffff} .borderblue {border: solid 1px #0000aa} I'm wondering if there is there a way to include these lines into a new line? Something like: **div.main {.whitebackground; .borderblue}** The result must be the same as it would be with this line: div.main {background-color: #ffffff; border: solid 1px #0000aa}

    Read the article

  • Running CLOC (count lines of code) on Windows...or alternative

    - by Chelonian
    I'm trying to use CLOC on Windows (XP) to count lines of code, and I can't get it to work. I downloaded the latest Win installer for CLOC 1.5.6, ran it (which caused a "DOS" window to open, scroll with text rapidly, then close before I could read anything) and then wrote cloc at the cmd prompt...and Windows doesn't recognize it as a command. Or if there is another easy-to-use lines of code counter that one could recommend (that runs on Windows), I'd be happy to try that.

    Read the article

  • Perl Insert Lines

    - by thebourneid
    How to change this code to insert lines if missing without deleting existing ones tie my @lines, 'Tie::File', $fn or die "could not tie file: $!"; for (my $i = 0; $i < @lines; $i++) { if ($ln_title == 0) { if ($i < $#lines and $lines[$i] =~ /(\s+TRACK \d\d .*)$/) { $lines[$i+1] = ' TITLE ""'; } } } untie @lines;

    Read the article

  • How do I make lines scale when using GLOrtho?

    - by Mason Wheeler
    I'm using GLOrtho to set up a 2D view that I can render textures onto. It works really well, up until I try to zoom in on the image. If I pass half the width and half the height of the viewport to GLOrtho, I end up with all my textures displayed twice as big as normal, which is exactly what I expect. But then I try to draw a box around part of the image and it all falls apart. I call glBegin(GL_LINE_LOOP), place the four vertices, and call glEnd, and I expect to see the same thing I would see if I drew it at normal zoom level, doubled. Instead, I get lines that are all the right length, but they all come out one pixel wide, instead of two, and it looks really bad. What am I missing?

    Read the article

  • In LaTeX, is there a way to get long lines along the margins?

    - by Christian Jonassen
    I'm working on a report, and some elements are outside the margins (but some are just barely outside the margins). I was wondering: Is there a way to make two vertical lines, one on each side, along the margins so that one can easily see if it goes outside them? (Googling it, I only found information about margin notes.) A figure is below: |report text goes here| |more text goes also h|ere |and so on and so fort|h It would certainly make correcting these kinds of mistakes very trivial. :) Feel free to post answers that would solve/show this problem in a more "LaTeX-correct" way, if that makes any sense at all.

    Read the article

  • Comparing 2 (or 3 Files If Possible) "Line By Line"

    - by PythEch
    I want to find out the differences of 2 (or 3 files if possible) line by line. Diff utils can do this, however it gives inaccurate results. Because, 2 files have exact number of lines which is "134". But diff gives me "Added Lines" and "Removed Lines". However this is wrong, they have exact the same number of lines, there is no added or removed lines. The text files which I want to find differences of them, have only numbers written, maybe that's why that algortihm fails. I couldn't find any option to prevent that, however I may be wrong, I mean there should be an option for that, but again, I couldn't find. This is what I get (5am.txt vs 6am.txt, there is a huge problem): This is what I want (6am.txt vs 7am.txt, still has problems): But, first the first image still has this problem, at the last lines. Edit: After I figured out that there is no utility to do this, I handled myself. I almost did the same thing as what RedGrittyBrick have done. This script imitates diff utility so I (or you) can use it with diff2html. To use it with diff2html, just change line diff_stdout = os.popen("diff %s" % string.join(argv[1:]), "r") to diff_stdout = os.popen("script.py %s" % string.join(argv[1:]), "r") and name this script whatever you want: import sys f1=open(sys.argv[1],"r") f1_read=f1.readlines() f1.close() f2=open(sys.argv[2],"r") f2_read=f2.readlines() f2.close() changed={} first_c = "" for n in range(len(f1_read)): if f1_read[n]!=f2_read[n]: if first_c == "": first_c=n+1 changed[first_c]=n+1 else: first_c="" #Let's imitate diff-utils... for (x, y) in changed.items(): print "%d,%dc%d,%d" % (x,y,x,y) for i in range(x,y+1): sys.stdout.write("< %s" % f1_read[i-1]) print "---" for i in range(x,y+1): sys.stdout.write("> %s" % f2_read[i-1]) Final results:

    Read the article

  • XNA 2D Spritesheet drawing rendering problem

    - by user24092
    I'm making a tile-based game, using one spritesheet containing all tile graphics. Each tile has a size of 32x32 pixels. The main problem is: when I draw the tile to the screen, if the tile position x and y are not rounded or if scale is activated in spriteBatch.Draw() method (scale != 1.0f), I get some lines of adjacent tiles on the spritesheet into the current tile drawed. I already tried setting SamplerState to PointClamp, removing AntiAlias, but still doesn't work. Here I'll show images of some tests that I made, with a test sprite sheet that I've created (I made a 9x9 spritesheet, with each sprite of size 32x32 containing a unique solid color). Tests: http://img6.imageshack.us/img6/5946/testsqj.png SpriteSheet used: http://imageshack.us/a/img821/1341/tilesm.png Already tried to remove anti-alias, set PointClamp as sampler state, but still getting this issue, XNA keeps drawing part of the adjacent pixels of the texture on the screen. What I want is to get the correct area of the tilesheet texture (as seen in the first test, that gets just the yellow pixels). My question is: Is there any way that I can fix this, WITHOUT adding tile spacing or any other modification involving the tilesheet? Maybe disabling a texture filtering that is done by XNA, or something like that.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >