Working Out The Point Positions Along A Straight Line?

Jul 22, 2010

I have two points (x1, y1) and (x2,y2) and have a straight line between the 2 points, from this I can work out the distance between the 2 points lets say it is 50.What I want to do is increase or decrease the length of the line by a predefined amount lets say 10.So If I increase the line length by 10 (from 50 to 60), What I want to work out is what point(x3,y3) would be at the end of the increased line.Hope this makes sense.I have tried to work out the new point using the angle but it does not work correctly, it does not seems to produce a perfectly straight line and the angle from point (x1,y1) to the new (x3,y3) is not the same as the angle from point (x1,y1 to x2,y2).

This is what I have tried:
:I work out the angle
aAngle =Math.Atan((Y2 Y1) / (X2 X2))

[code].....

View 1 Replies


ADVERTISEMENT

Finding A Point On A Diagonal Line When Have The Start Point And End Point Of The Line?

Feb 14, 2011

I have a Diagonal line drawn on a picture box on my forum and i need to know if the user has clicked the line I have the Start point and End Point of the Line and the mouse x,y location So i basically need to find out if the x,y of the mouse is on the line.

View 2 Replies

VS 2010 - Draw A Straight Line Between Two Points And Calculate The Length Of That Line?

Jan 3, 2012

I have a picture in my picturebox. In that picture, I need to draw a straight line between two points and calculate the length of that line (probably in pixels). Is there any suggestion how to do it?

View 2 Replies

Straight Line And Dots?

Jun 12, 2011

I'm in this proyect where I need an area in the form where I can place just dots, then join these dots with an straight line between them.how can I do that? I placed a Picturebox to see functions there but nothing is clear.

View 3 Replies

Using As A Straight 'finishing Line'?

Jan 24, 2010

I have a line shape which I am using as a straight 'finishing line'. As the program runs an identically shaped line shape appears. I am a little confused from where and how it is appearing, as I only have the one line shape. Also, on some runs of the program 'trails' of the cars that are racing across the screen remain.Are these issues something simple I can fix?

View 5 Replies

Calculating New Points Along A Straight Line In C#

Jul 22, 2010

[Code]...

If someone could post some sample code, in either c# or vb.net that would be much appreciated.

View 1 Replies

Make A Text To Move On A Straight Line Continuously?

May 29, 2012

I use this cod but it not moving the text contnusly Private sub Timer1............ Label1.text = " " & Label1.text

View 1 Replies

Creating A WPF Application To Draw A Straight Black Line On A Canvas

Aug 16, 2010

Under the MouseLeftButtonUp event handker store the first coordinates of the lines second endpoint. Then call the length method to obtain the distance between the two endpoints(the lines length). Fianlly display the line on the canvas and the line's length in the Length=Label. Below is the code I have so far. There are no errors, but when I run the application nothing happens.

Private Sub lineCanvas_MouseLeftButtonUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArg... Handles lineCanvas.MouseLeftButtonUp
Dim distance As Double
endPoint = e.GetPosition(lineCanvas)

[Code].....

View 2 Replies

Draw Line From One Point To Another Point?

Apr 10, 2012

I have a DataGridView that will occasionally have a RowError icon displayed in the RowHeader (shown below)I have code that displays a small form when the users mouse moves over the row header or clicks the row header.I would like to draw aline from the top-left of the form to the middle-right of the row header.I basically want to point from the form to the error icon.

View 1 Replies

VS 2008 Depreciation Loop - Calculate Straight-line Depreciation (cost * 1/n) N Being The Number Of Years To Depreciate

Jul 25, 2010

I have a program where I have to calculate straight-line depreciation (cost * 1/n) n being the number of years to depreciate, and Double-Declining depreciation (cost * 2/n) using user input for year of purchase, cost, and years of depreciation. The output needs to be put into 4 columns in a list box. Year, Value at beginning of year, Amount of depreciation during the year and Total depreciation to the end of the year.

The problem I am having is with my loop. It is not properly calculating. I'm sure I am doing something wrong that is simple, but I can't see it.

Here is my code; the problem areas are bold:

Public Class frmDepreciation

Dim Cost, Life, Year, Depreciation, BegValue, EndValue, Total, Counter As Double
Dim fmtStr As String = "{0,-10}{1,10}{2,17}{3,5}{4,-15}"
Dim fmtStr2 As String = "{0,-10}{1,10}{2,17}{3,15}"

[CODE]....

View 3 Replies

VS 2008 - Working With Doubles - Numbers Seem To Round After The Decimal Point

Apr 1, 2009

intLoginTime = txtLoginTime.Text
intLogoutTime = txtLogoutTime.Text

[CODE]..........

The problem is that the numbers seem to round after the decimal point, so if I entered a login-time of 8.15 and log-out 9.30, instead of showing 1.15 as the difference, it shows '1'. is there a way around this?

View 13 Replies

Find Line Intersection Point With A Grid Of Lines?

Jun 4, 2009

I am suing VB 2008 express edition.

I am trying to solve this problem since many days. The problem seems to be rather mathematical, but I faced difficulties dealing with Grids and how to store them using visual basic.

[URL]

In my problem, I have a world of 200 x 200 units divided into 4 x 4 grids (Each of 50 units).

There is a line crosses some areas has the coordinates of Point A (Starting Point) of (XA = 12.43, BA = 159.48) and Point B coordinates (Ending Point) of (XB = 112.95, YB = 20.95).

The question is, how can find the length of (A to C1), (C1 to C2), (C2 to C3), (C3 to C4), (C4 to C5) and finally (C5 to B)?

In addition, how can I indicate the square in which the line is inside?

note that the method should work for all conditions (-ve and +ve line slopes) and for different A and coordinates.

View 1 Replies

Maze Each Time - Draw Line(+ A {} At Each Connecting Point)?

Aug 3, 2010

i wanta like is like a maze each time u click it exendese the line.the promblem is the walls and well i dont know how to draw line(+ a {} at each connecting point) and have the line not be able to pass the wall and if it pass it, it able to detect the shorts path of lines which u can set it on if off. for the training session.

View 3 Replies

VS 2008 Set A Point Without Setting Point.x And Point.y Separately

Jun 4, 2009

I hve been working with points a lot recently, and I have been wondering if there is a way to set a point without setting point.x and point.y separately. For example for (3, 5): Point1 = (3, 5) But that isn't right

View 4 Replies

VS 2010 : Search For Text Within A String (Starting Point And Ending Point)?

Dec 31, 2010

I'm trying to extract a piece of text from within the string, defining both a starting point and an ending point. For instance, say I want to search for the text found between "That is a " and " car" in the string "That is a red car", so it would return "red".I know you can use .SelectionStart and SelectionLength, but the length of the word can change, so the selection length can vary. What I want is to establish a specific starting point and a specific ending point from which to extract the text from the string.

View 5 Replies

VS 2010 Loop In A Variable And Grab Info From Point A To Point B?

May 24, 2010

I want to know if its possible to loop in a variable and grab info from point a to point b

This is what I have stored in my Variable

PHP
</div> <!-- div reviews end white-space:nowrap; margin-bottom:5px; class="reviews" -->
<div class="list_address">

[Code].....

View 11 Replies

Run Cmd Commands Straight ?

Jun 16, 2011

Is is possible to run cmd commands straight from VB. I want to be able to set up a command in vb without showing the black cmd window

path= C:Program Files (x86)Javajre6in
java -Xmx1024M -Xms1024M -jar minecraft.jar nogui

Is it possible to run it without making a batch file? ( I want be be able to change some of the values in the commands to)I found Shell(pathname[,windowstyle]) but I am not quite sure how to use it or if it is the right code.

View 2 Replies

Add Point And Delete Point When The User Clicks The Picture?

Jul 29, 2009

i have a picturebox which displays a map i have 2 modes add point and delete point when the user clicks the picture it creates a point on the picture where the user has clicked that works perfectly its when i try and delete the point when it doesent work :/ i have all the points loading from an xml file this is the code i have:

[Code]...

basicly i want it to when the user clicks the point it fines the x any y in the xml delete the node then delete all the points on the map then reload them all according to the xml

View 9 Replies

Tab Positions In A TextBox?

Feb 18, 2011

Is it possible to add text to a multiline textbox in a particular column? Like so:

Sugar 10 Ohio
Coffee 50 Texas

Or should I be using a different contro

View 5 Replies

Replacing Line Break With HTML Br Not Working?

Oct 12, 2011

I am trying to submit some information into a database using an ASP.NET multiline textbox.I have the following code:

Dim noteContent As String = Replace(txtNoteContent.InnerText.ToString(), vbCrLf, "<br />")
Shop.Job.Notes.addNote(Request.QueryString("JobID"), ddlNoteFrom.SelectedValue, ddlNoteTo.SelectedValue, noteContent)

[code].....

View 2 Replies

Cards Needed For A Straight

Nov 24, 2009

how to calculate how many cards are needed at least to make a straight in texas hold'em?

pratic examples:[code..]

View 2 Replies

Manipulating Pictureboxes Positions?

Dec 18, 2011

i'm creating a game like text twist. that when i press letter a, i need to determine which picturebox contains letter a and display it to different location. that also goes to the proceeding letter a's. for example, i have a jumbled letters "aamba". in my code, it only gets the first letter a and removes it form the screen, it's nowhere to be found. and it won't recognize that i still have other letter a's i'm pretty sure about the location that i set it to be placed.here is my

(it's kind of brute force i think)
ElseIf e.KeyChar = Chr(97) Then
counter1 = 0[code].....

View 7 Replies

Allow Certain Characters In Certain Positions In Text Box?

Feb 10, 2010

For example I only the second character in each line to be an x, while the 3nd to 10th character must be a hex digit.At the moment I use a Select Case, then check the position of the caret (using textbox.selectionstart) and see if the key being pressed is a "legal" character.Is there a better way of doing this as it slows down on large amounts of text.

This is the code I have at the moment:
Select Case TextBox1.SelectionStart
Case TextBox1.GetFirstCharIndexOfCurrentLine + 1

[code]......

View 4 Replies

Changing Picturebox X / Y Positions

Mar 5, 2011

I'm trying to make my own clone of space invaders as it's been about a year since I've done any programming, and I imagine this will be a good way to get back into it. The main issue that I am having right now, is that I am basically clueless as to how I go about moving the player on a keypress. I have the code for the keyboard input correct, how to move my picturebox.

Here's my code so far (in a nutshell):
Dim PlayerPositionX as integer
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.Left
[Code] .....
I imagine I probably messed up very badly on this, but I'm completely lost!

View 4 Replies

Set Positions Of Many Pictureboxes Efficiently?

May 23, 2011

I have 20 PictureBoxes named PictureBox2 through to PictureBox 21, where I need to conditionally set the positon of them. I was wondering if there is a more efficient way to set their positions than to copy the code out 20 times. This is what I have so far:

For NextPos As Integer = 2 To 21
Select Case Direction
Case 1

[code]....

View 4 Replies

VS 2008 Get The Icons Positions?

Aug 5, 2010

how i could get the icons positions i made some code to get the file names and everything but wanted to know how i could get there positions! also i found some codes with google but most of them where in vb6?

View 10 Replies

Calculating Point-to-point Directions On A 2-D Grid?

Mar 11, 2012

I'm trying to calculate the direction between two points on a two-dimensional grid. Actually I want to determine if that vector is within a range of two values. Suppose the grid's origin is 0,0 at the upper left corner, and 0 degrees represents north. I have a point A on that grid. I want to know if a line from point A to point B on the grid is within a range of directions between 111.8 degrees (a little south of east) and 158.2 (a little east of south). Those are approximations; the 111.8 is 90 degrees plus the arctangent of 2/5, and 158.2 is 180 minus that value. I worked out a series of calculations worthy of a medieval astronomer, but I suspect there is a simpler way. I'm going to have to do this for a variety of other vectors, and I'd like to generalize

View 4 Replies

Construct An Icon Setting Point By Point

Feb 20, 2010

I know how I can construct an icon setting point by point, but that isn't what I want. I want to use a bitmap file or a jpeg -is easy to convert an jpeg to an bitmap- and built an icon that looks like this picture.

View 2 Replies

Draw Arc From Start Point, End Point And Radius?

Jan 17, 2009

I want to make a drawing application which needs a few drawing functions I cant handle myself as im not very mathematicly inclined The first on the list of functions is to create an arc from a start point, end point and radius. The method signature is as followes.

Function CreateArc(byval StartPoint as PointF, EndPoint as PointF, Raduis as single) As PointF()
'Code to create an array of points...

[Code]....

View 1 Replies

VS 2005 Drawing Straight Lines?

Apr 15, 2009

How do I draw straight lines? I'm working on a tic-tac-toe game and I have no previous experience with graphics in VB 2005. The MSDN doesn't exactly do a good job of explaining it. In QBasic it was very simple, you just did:

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved